Code Monkey home page Code Monkey logo

Comments (11)

winsock avatar winsock commented on May 27, 2024 1

Hi @egorsmkv thanks for the bug report!

I believe I see the issue in the library, I do not return the error in Dial if authentication is unsuccessful.

I will fix this oversight shortly and test this error condition to ensure it's working properly.

from eslgo.

winsock avatar winsock commented on May 27, 2024 1

I will open another issue tracking this feature request and I will get it added in for the next release. Thanks @egorsmkv!

from eslgo.

egorsmkv avatar egorsmkv commented on May 27, 2024

Thanks, I wait to test it as well.

from eslgo.

winsock avatar winsock commented on May 27, 2024

@egorsmkv I have created what should fix this issue in #6 I have also created a release candidate tag for easier testing by yourself. You can switch to v1.3.3-rc to verify if it is working as expected.

I personally used this example to confirm things are working as intended:
https://github.com/percipia/eslgo/blob/close_fix/example/events/events.go

from eslgo.

egorsmkv avatar egorsmkv commented on May 27, 2024

Now, it closes as intented but now I am getting a randomized panic:

INFO[0003] Inbound Connection Disconnected              
ERRO[0010] failed to auth Content-Type: []string{"command/reply"}
Reply-Text: []string{"-ERR invalid"} 
panic: send on closed channel

goroutine 16 [running]:
github.com/percipia/eslgo.(*Conn).receiveLoop(0xc000090a20)
	/root/gopath/pkg/mod/github.com/percipia/[email protected]/connection.go:250 +0x299
created by github.com/percipia/eslgo.newConnection
	/root/gopath/pkg/mod/github.com/percipia/[email protected]/connection.go:67 +0x53a

from eslgo.

winsock avatar winsock commented on May 27, 2024

@egorsmkv It looks like this uncovered an underlying issue that wasn't shown due to the connection never exiting. I have pushed 1.3.3-rc2 that resolves this panic.

from eslgo.

egorsmkv avatar egorsmkv commented on May 27, 2024

It seems the issue is still here:

INFO[0019] Inbound Connection Disconnected              
ERRO[0022] failed to auth Reply-Text: []string{"-ERR invalid"}
Content-Type: []string{"command/reply"} 
panic: send on closed channel

goroutine 53 [running]:
github.com/percipia/eslgo.(*Conn).receiveLoop(0xc000158240)
	/root/gopath/pkg/mod/github.com/percipia/[email protected]/connection.go:252 +0x2b9
created by github.com/percipia/eslgo.newConnection
	/root/gopath/pkg/mod/github.com/percipia/[email protected]/connection.go:67 +0x53a

from eslgo.

winsock avatar winsock commented on May 27, 2024

Hi @egorsmkv

I resolved the race condition being caused by the early shutdown due to auth. Thank you for finding it, I'm sure we would've been bitten by it at some point in the future. Can you try 1.3.3-rc3 to verify that the issue is indeed gone for good this time?

from eslgo.

egorsmkv avatar egorsmkv commented on May 27, 2024

Now it properly works! Thank you, Andrew!

I just noticed that when the connection is closing here appears this error:

Error receiving message read tcp 127.0.0.1:50022->127.0.0.1:8021: use of closed network connection

and thisL

Failed to auth &{%!e(string=write) %!e(string=tcp) %!e(*net.TCPAddr=&{[127 0 0 1] 50026 }) %!e(*net.TCPAddr=&{[127 0 0 1] 8021 }) %!e(*errors.errorString=&{use of closed network connection})}

Is this normal?

from eslgo.

winsock avatar winsock commented on May 27, 2024

I'm glad to hear it! Thank you for raising the issue!

Those messages are normal around the shutdown of the connection. They are printed to the log just in case to help trace if there are any issues. I could potentially add in an option to either redirect the logging messages to a supplied logger or to quiet the internal library logs messages.

You can see where they happen here:
https://github.com/percipia/eslgo/blob/close_fix/connection.go#L243
https://github.com/percipia/eslgo/blob/close_fix/inbound.go#L68

from eslgo.

egorsmkv avatar egorsmkv commented on May 27, 2024

Yes, the ability to set own logger would be so useful!

I am using logrus inside my project so I can suppress these messages by setting the logging level.

from eslgo.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.