Skip to content

Instantly share code, notes, and snippets.

@kanatohodets
Last active September 4, 2015 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kanatohodets/6642786a927c2616f6f2 to your computer and use it in GitHub Desktop.
Save kanatohodets/6642786a927c2616f6f2 to your computer and use it in GitHub Desktop.
# I think this is trying to write to the socket after closing/freeing it.
# connect with netcat or something: nc localhost 3005
react {
whenever IO::Socket::Async.listen('localhost', 3005) -> $sock {
start {
$sock.print("thank you for subscribing to CAT FACTS\n");
$sock.close;
}
}
}
@kanatohodets
Copy link
Author

changing the start block to this:

$sock.print('stuff');
sleep 1;
$sock.close;

prevents me from reproducing the segfault, and judging by the printf debugging I did in Moar, allows uv_write to complete in src/core/asyncsocket.c. In the failure case, handle_data->handle is NULL in the body of write_setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment