[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error
From: |
Evgeny Grin |
Subject: |
Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error |
Date: |
Tue, 14 Mar 2017 23:21:11 +0300 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 14.03.2017 20:01, Vitaliy T wrote:
>> Then you could use MHD_DAEMON_INFO_EPOLL_FD with MHD_get_daemon_info()
>> or MHD_get_fdset(). MHD_get_fdset() will fill fdsets with single epoll
>> fd. Epoll fd itself is select()-able, poll()-able and epollable.
>
> Currently, I am implementing a server which should work with epoll and select.
> I have solved issues with select-based implementation in a way described
> below:
>
> 0. From DH (default handler) I call a function to resume a
> connection, it's access
> the internal database to retrieve the MHD_Connection connection handler.
> 1. MHD_get_fdset()
> 2. select() with timeout is around 0-100ms (works with both 0 and 100ms)
> 3. MHD_run_from_select()
Why do you start from resuming connection?
> In this way seems to be everything is working as expected. Also, I
> have set timeout
> connection value >= 15 seconds and skipped calling MHD_get_timeout().
> Once again,
> quote from Reference Manual:
>
> int MHD_get_timeout (...)
> ...
> The function must also not be called by user-code if
> MHD_USE_INTERNAL_SELECT is in use.
>
> But, microhttpd.h again is missing this important note.
You should never call any of MHD_run(), MHD_run_from_select() and
MHD_run_from_select() in you started MHD with internal thread
(MHD_USE_INTERNAL_SELECT). Note that MHD_USE_THREAD_PER_CONNECTION imply
usage of MHD_USE_INTERNAL_SELECT.
Thanks pointing out that notes are missing in header, I'll add them.
>
>
> For epoll I don't know which scheme I should use. I don't really want
> to implement
> an external epoll. I wish something like I done above for select based daemon.
>
> Currently, for epoll instead of using MHD_get_fdset + MHD_run_from_select I
> call
> just MHD_run(). In such way the daemon is working as expected, at least at
> first
> glance.
>
> Calling MHD_get_fdset() under MHD_USE_EPOLL_LINUX_ONLY returns MHD_NO,
> as I noted early. I accept such a behavior.
MHD_get_fdset() may return MHD_NO if epoll FD is too high to fit fd_set
or if MHD_get_fdset() erroneously called for daemon with
MHD_USE_THREAD_PER_CONNECTION option.
While exploring MHD abilities, I recommend to use MHD_USE_DEBUG options.
--
Wishes,
Evgeny
- [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error, Vitaliy T, 2017/03/14
- Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error, Vitaliy T, 2017/03/14
- Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error, Evgeny Grin, 2017/03/14
- Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error, Vitaliy T, 2017/03/14
- Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error,
Evgeny Grin <=
- Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error, Vitaliy T, 2017/03/15
- Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error, Vitaliy T, 2017/03/15
- Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error, Evgeny Grin, 2017/03/15
- Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error, Vitaliy T, 2017/03/15
- Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error, Vitaliy T, 2017/03/15
- Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error, Evgeny Grin, 2017/03/15
- Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error, Vitaliy T, 2017/03/15
- Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error, Evgeny Grin, 2017/03/15
- Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error, Vitaliy T, 2017/03/15