zeromq / zebra

REST/HTTP to XRAP gateway
Mozilla Public License 2.0
27 stars 10 forks source link

deadlock on windows #36

Open KrishnaPG opened 8 years ago

KrishnaPG commented 8 years ago

The hello.c example when run on windows, is "freezing" with below call stack: image

The main thread is halted at zeb_client_set_handler:

    zebra_selftest.exe!s_accept_reply(_zeb_client_t * self, ...)  Line 1386 + 0xb bytes C++
    zebra_selftest.exe!zeb_client_set_handler(_zeb_client_t * self, const char * method, const char * route)  Line 1465 + 0x15 bytes    C++
>   zebra_selftest.exe!main()  Line 21 + 0x13 bytes C++

while a worker thread is frozen on s_accept_reply inside zeb_client_request:

    zebra_selftest.exe!zstr_recv(void * source)  Line 73 + 0xf bytes    C++
    zebra_selftest.exe!s_accept_reply(_zeb_client_t * self, ...)  Line 1386 + 0xb bytes C++
>   zebra_selftest.exe!zeb_client_request(_zeb_client_t * self, unsigned int timeout, _zmsg_t * * content_p)  Line 1482 + 0x15 bytes    C++
    zebra_selftest.exe!answer_to_connection(void * cls, MHD_Connection * con, const char * url, const char * method, const char * version, const char * uploaded_data, unsigned int * uploaded_data_size, void * * con_cls)  Line 476 + 0xf bytes   C++
    zebra_selftest.exe!MHD_connection_handle_idle(MHD_Connection * connection)  Line 2547 + 0x37 bytes  C
    zebra_selftest.exe!MHD_handle_connection(void * data)  Line 1021 + 0x68 bytes   C

What exactly is the flow and how to resolve this?

sappo commented 8 years ago

@KrishnaPG I personally didn't test zebra on windows. But it seems like something went wrong in the broker. Did you use the msvc build files for windows?

KrishnaPG commented 8 years ago

It looks like the state-machine is going awry. Somehow the objects are entering the 'disconnected' or 'expired' state even before the proper signals are reached on the other side (whoever the listener).

Sync is missing between the client / server / broker etc. Do you happen to have the exact flow or some sequence diag what is supposed to happen after what? It could help debug the issue.

Also, I see some debug log statements throughout the code - what is the right way to see those debug output? any good tool ?

sappo commented 8 years ago

Hmm... that's weird. The selftests and the example are using inproc protocol to communicate not sure if that works on windows. The protocol between broker and clients is defined here https://github.com/zeromq/zebra/blob/master/src/xrap_traffic.bnf. You can enable the debug statements by sending the string VERBOSE to the broker or the clients.

Am 29.08.2016 07:31 schrieb "Gopalakrishna Palem" <notifications@github.com

:

It looks like the state-machine is going awry. Somehow the objects are entering the 'disconnected' or 'expired' state even before the proper signals are reached on the other side (whoever the listener).

Sync is missing between the client / server / broker etc. Do you happen to have the exact flow or some sequence diag what is supposed to happen after what? Also, I see some debug log statements throughout the code - what is the right way to see those debug output? any good tool ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zeromq/zebra/issues/36#issuecomment-243035301, or mute the thread https://github.com/notifications/unsubscribe-auth/AAeGuuwE2x5Z0DCkBc_d7uTsTDnYeQhTks5qkm6fgaJpZM4Ju4l2 .

bluca commented 8 years ago

Inproc is just a custom in memory queue so it should work in Windows too, we have tests in libzmq

KrishnaPG commented 8 years ago

inproc is working fine. It is the thread sync that is going wrong somewhere.