Closed GoogleCodeExporter closed 8 years ago
This could be related or a duplicate of issue 273
Original comment by jcmay...@gmail.com
on 12 Aug 2011 at 1:59
I think they are related but not a duplicate. The problem here is that the
socket is kept open, even if a mg_stop call is issued. There has to be a way to
signal the read to quit.
Original comment by borkh...@gmail.com
on 12 Aug 2011 at 6:20
I had this issue as well. The problem boils down to Mongoose using the
synchronous recv call instead of an asynchronous one (similarly with
send...which is related to another issue I'm hitting).
The short term fix is to call set_non_blocking_mode on the socket, and double
check that all the functions calling pull can properly handle asynchronous
mode. And then in those outer loops calling pull, do a check against
conn->ctx->stop_flag.
Of course, this is a short term fix, as this doesn't protect against any sort
of malicious attacks. So I suggest having configurable timeouts in these
threads as well.
Original comment by chester....@gmail.com
on 14 Sep 2011 at 4:48
Hi,
I’m working on Android platform and have the same problem. As this issue is
very similar to bug #273 I tried the suggested solution there:
Adding the following code.
Then in the "process_new_connection" function after the line
keep_alive_enabled = !strcmp(conn->ctx->config[ENABLE_KEEP_ALIVE], "yes");
Add the following:
if ( keep_alive_enabled )
{
// Enable read timeouts on the socket
DWORD tv = 15 * 1000; //15 sec, probably should go in the config file...
if (setsockopt(conn->client.sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)))
{
cry(conn, "setsockopt failed");
}
}
The problem is that setsockopt always returns -1. When I run the same code on
WIN32 it’s working.
In the setsockopt documentation for RCVTIMEO it says “Note that not all
implementations allow this option to be set”.
http://pubs.opengroup.org/onlinepubs/009604599/functions/setsockopt.html
is there a work around for Android?
Is this issue fixed on mongoos 3.1?
Any help will be very much appreciated!
Guy Shachar
ggguuyyy@gmail.com
Original comment by ggguu...@gmail.com
on 14 Feb 2012 at 8:41
Solved this issue by adding a select-call to pull. The second socket used here
is written when mg_stop is called.
Attached a diff file (diff to latest version in repository) containing the
change.
Original comment by borkh...@gmail.com
on 21 Jun 2012 at 10:03
Attachments:
Also see http://code.google.com/r/borkhuis-issue268/source/browse for the new
version.
Original comment by borkh...@gmail.com
on 21 Jun 2012 at 1:41
This must be fixed now.
Mongoose does select() in read_request, and exits if mg_stop is called.
Please verify.
Original comment by valenok
on 23 Sep 2012 at 12:57
Issue 273 has been merged into this issue.
Original comment by valenok
on 23 Sep 2012 at 12:58
This does appear to be working for me now. At least on Windows builds.
Original comment by jcmay...@gmail.com
on 6 Nov 2012 at 9:30
Awesome, thanks for clarifying.
Original comment by valenok
on 25 Dec 2012 at 11:26
Original issue reported on code.google.com by
borkh...@gmail.com
on 21 Jul 2011 at 6:13