Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connection stay in CLOSED state #11

Closed
schmurfy opened this issue Dec 31, 2012 · 10 comments
Closed

connection stay in CLOSED state #11

schmurfy opened this issue Dec 31, 2012 · 10 comments

Comments

@schmurfy
Copy link
Contributor

I tested the gem with the master branch of mruby and master of libuv (I first tested with the latest stable release but uv_run2 was only added after), when I run the tcp-server example it works fine except that it never detects CLOSED connection (the puts/write timer continue and lsof reports the socket as CLOSED).

Since it may be an issue with the master branch of libuv I was wondering which revision you tested this gem with.

I did some minor changes to compile on Mac OS X but I am confident they are not causing the issue since they concern only the building part, I will send you a pull request but I want to make sure everything works fine before that.

@mattn
Copy link
Owner

mattn commented Jan 1, 2013

How can I reproduce it? ctrl-c ?

@schmurfy
Copy link
Contributor Author

schmurfy commented Jan 1, 2013

What I did was just opening up another console and connecting to the server with nc:

$ nc 127.0.0.1 8888

after ctrl+c the nc process here is what lsof reports:

$ lsof -nPi | grep mruby
mruby     14724 [...]      0t0  TCP 127.0.0.1:8888 (LISTEN)
mruby     14724 [...]      0t0  TCP 127.0.0.1:8888->127.0.0.1:50603 (CLOSED)

and the mruby process is still printing happilly "helloworld" every second.

I am ruby it on Mac OS X so it may also be an issue with the master branch of libuv under Mac OS X xD

mattn added a commit that referenced this issue Jan 1, 2013
@mattn
Copy link
Owner

mattn commented Jan 1, 2013

I added bits code for GC. but mruby-uv need to call UV::gc to gc currently.
This is not completely fixes.

@schmurfy
Copy link
Contributor Author

schmurfy commented Jan 2, 2013

During my tests the rescue block wasn't even executed since no exception was raised, it almost looks like something is missing to cleanup the closed socket.

Do you experience the same behavior I described ? If not can you give me the revision of your libuv install so I can check with it ?

@mattn
Copy link
Owner

mattn commented Jan 17, 2013

In latest version, It seems occur SIGPIPE if closes nc connection.

@schmurfy
Copy link
Contributor Author

I just tried with latest version of your gem and mruby with libuv 0.9.4, same issue.
I also tried with libuv compiled from the master branch but mruby-uv doesn't compile :(

What did you meant by latest version ? latest version of your gem ?

@mattn
Copy link
Owner

mattn commented Jan 23, 2013

libuv changed uv_run() interface. I'll fix soon.

@mattn
Copy link
Owner

mattn commented Jan 23, 2013

done.

@schmurfy
Copy link
Contributor Author

It compiles but sadly I still have the same behavior with netcat :(
The server contnue to send happily helloworld although the peer is no longer there and lsof still shows the socket in CLOSED state.

@mattn
Copy link
Owner

mattn commented Jan 24, 2013

It should occur SIGPIPE. latest mruby-uv/example/tcp-server.rb handles SIGPIPEs.

@schmurfy schmurfy closed this as completed Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants