Forums » Development »
[Abandoned] fdevent_handler in lighttpd is not triggering the callback api
Added by pradeep.labheswar over 5 years ago
Hi lighttpd team,
Pre-requisite:
My request flow would be like this.
lighttpd shall process the request and my mod_XXX(this shall use a IPC) process the request and send certain information to other processes.
The other processes shall send some info back as well to lighttpd via the above IPC. when this info is sent we write it into a pipe so as lighttpd reads from other end.
For this pipe event we use fdevent_handler.
I recently moved from 1.4.44 to 1.4.54 because in .44 connection_close plugin call backs were not called when a fin event is received to lighttpd and on advice changed to this version.
Now the issue is my pipe event is not getting triggered on write api call.
I use linux-sysepoll as event handler.
880 p->fdn = fdevent_register(srv->ev, p->fd[0], message_process, p);
881 if (fdevent_fcntl_set_nb(srv->ev, p->fd[0]) == 1)
882 {
884 fdevent_unregister(srv>ev, p->fd[0]);
885 return HANDLER_ERROR;
886 }
887 fdevent_fdnode_event_set(srv->ev, p->fdn, FDEVENT_IN);
Am I missing anything important function call or any important step ?
Replies (7)
RE: fdevent_handler in lighttpd is not triggering the callback api - Added by pradeep.labheswar over 5 years ago
server.modules = ( "mod_indexfile", "mod_openssl", "mod_auth", "mod_access", "mod_xxx", "mod_compress", "mod_deflate", "mod_accesslog" )
accesslog.filename = "/lab/www/access.log"
server.document-root = "/lab/www/htdocs/"
server.errorlog = "/lab/www/error.log"
server.event-handler = "linux-sysepoll"
server.max-fds = 8192
server.max-keep-alive-idle = 10
server.max-read-idle = 60
server.max-worker = 4
server.bind = "12.0.0.1"
server.port = 80
ssl.engine = "disable"
$SERVER["socket"] == 127.0.0.1:80" {
.....
}
RE: fdevent_handler in lighttpd is not triggering the callback api - Added by gstrauss over 5 years ago
Now the issue is my pipe event is not getting triggered on write api call.
None of the information you provided above provides sufficient details for any conversation to begin.
x-ref: https://redmine.lighttpd.net/boards/2/topics/8653
If your module is to handle the request, then it should provide a routine for p->handle_subrequest. Since you're using pipes, see mod_cgi.c. If you're using sockets, take a look at mod_sockproxy.c and how it and many other modules use gw_backend.c for TCP sockets to backends.
RE: fdevent_handler in lighttpd is not triggering the callback api - Added by pradeep.labheswar over 5 years ago
Thank you strauss we shall check on the fdvent_handler usage, the reason to upgrade the 54 is we are not receiving the connection close trigger, even in 54 also the same is observed.
NOTE: I removed the fdevent handler in my code for now, as issue was with connection close before a response.
Scenario is like this,
1. Any test module, let it take to send response after 60 secs.
2. Send a request to lighttpd to hit the test module.
3. after 2-5 secs close the connection from client side (if using curl do ctrl+c) FIN is instantiated from client side to lighttpd
4. Expectation is connection_close function should get hit immediate. A return FIN needs to be send by lighttpd.
5. Reality its in CLOSE_WAIT state for 30 secs and then the connection is getting closed. return FIN is not sent back to client.
RE: fdevent_handler in lighttpd is not triggering the callback api - Added by pradeep.labheswar over 5 years ago
Check with attached pcap. return FIN is sent after 30 seconds.
In general, what I can see from the behavior is suppose if a connection receives a FIN before lighttpd can send a response back, its not sending the FIN immediate instead its waiting either for 30 secs or for the response to be sent back only the the socket is closed until then its in CLOSE_WAIT state.
Please let me know on any information required will share you.
FIN_30_FIN.pcap (901 Bytes) FIN_30_FIN.pcap |
RE: fdevent_handler in lighttpd is not triggering the callback api - Added by gstrauss over 5 years ago
4. Expectation is connection_close function should get hit immediate. A return FIN needs to be send by lighttpd.
citation needed
Why would that be "correct" behavior in a generic web server?
The behavior in lighttpd is intentional, and somewhat documented in the code, which you obviously have not read. Nor have you demonstrated knowledge of HTTP/0.9 or HTTP/1.0 or HTTP/1.1, which would be a prerequisite to understanding the behavior implemented by lighttpd.
RE: fdevent_handler in lighttpd is not triggering the callback api - Added by pradeep.labheswar over 5 years ago
Thanks for your patience and support Strauss.
Sorry for asking such a question. My bad.
RE: fdevent_handler in lighttpd is not triggering the callback api - Added by gstrauss over 5 years ago
You made a statement, and did not provide support for your assumptions or arguments. That is different from asking a question.
"Am I missing anything?" is indeed a question, and the only question you asked. All the assumptions behind it are not questions. In your words, this is your opening:
Pre-requisite:
My request flow would be like this.