[zeromq-dev] Behavior question for Malamute self_test
Kevin Sapper
kevinsapper88 at gmail.com
Sat Apr 30 13:25:22 CEST 2016
In my experience debugging multithreaded applications will give you
unexpected unreliable results. Better use printf or logs.
Am 29.04.2016 6:50 nachm. schrieb "Michal Vyskocil" <
michal.vyskocil at gmail.com>:
> Interesting, the disconnect is reported in the same second as connect.
>
> My guess is that the debugger stops the mlm_server actor, so it became
> disconnected from clients pov. But it should happen after 3 unsuccessful
> pings.
> Dne 29. 4. 2016 4:33 PM napsal uživatel "Osiris Pedroso" <
> opedroso at gmail.com>:
>
>> I noticed that if I set a breakpoint in the line below marked "BP>", and
>> do single step execution of the asserts and zstr_free statements, the next
>> receive will fail and the test does not proceed beyond that point.
>>
>> In malamute\src\mlm_client.c, mlm_client_test() has these code lines:
>> ```
>> mlm_client_set_producer (writer, "weather");
>> mlm_client_set_consumer (reader, "weather", "temp.*");
>>
>> mlm_client_sendx (writer, "temp.moscow", "1", NULL);
>> mlm_client_sendx (writer, "rain.moscow", "2", NULL);
>> mlm_client_sendx (writer, "temp.madrid", "3", NULL);
>> mlm_client_sendx (writer, "rain.madrid", "4", NULL);
>> mlm_client_sendx (writer, "temp.london", "5", NULL);
>> mlm_client_sendx (writer, "rain.london", "6", NULL);
>>
>> char *subject, *content;
>> mlm_client_recvx (reader, &subject, &content, NULL);
>> assert (streq (subject, "temp.moscow"));
>> assert (streq (content, "1"));
>> assert (streq (mlm_client_command (reader), "STREAM DELIVER"));
>> assert (streq (mlm_client_sender (reader), "writer"));
>> zstr_free (&subject);
>> zstr_free (&content);
>>
>> BP> mlm_client_recvx (reader, &subject, &content, NULL);
>> assert (streq (subject, "temp.madrid"));
>> assert (streq (content, "3"));
>> assert (streq (mlm_client_command (reader), "STREAM DELIVER"));
>> assert (streq (mlm_client_subject (reader), "temp.madrid"));
>> assert (streq (mlm_client_sender (reader), "writer"));
>> zstr_free (&subject);
>> zstr_free (&content);
>>
>> // this next recvx never returns... have to ^C to stop the test run...
>> rc = mlm_client_recvx(reader, &subject, &content, NULL);
>> assert(rc != -1);
>> assert(streq(subject, "temp.london"));
>> assert(streq(content, "5"));
>> ```
>>
>> When running the test with verbose and breakpoint enabled I see these
>> printouts that I do not see when running with no breakpoints.
>>
>> ```
>> D: 16-04-29 09:20:53 1251:mlm_client : connected:
>> D: 16-04-29 09:20:53 1251:mlm_client : connected:
>> D: 16-04-29 09:20:53 1251:mlm_client : expired
>> D: 16-04-29 09:20:53 1251:mlm_client : expired
>> D: 16-04-29 09:20:53 1251:mlm_client : $
>> server has gone offline
>> D: 16-04-29 09:20:53 1251:mlm_client : $
>> server has gone offline
>> D: 16-04-29 09:20:53 1251:mlm_client : >
>> disconnected
>> D: 16-04-29 09:20:53 1251:mlm_client : >
>> disconnected
>> D: 16-04-29 09:20:53 1251:mlm_client :
>> disconnected:
>> D: 16-04-29 09:20:53 1251:mlm_client :
>> STREAM_DELIVER
>> D: 16-04-29 09:20:53 1251:mlm_client : >
>> disconnected
>> ```
>>
>> Any ideas why stepping over seven source code lines (no matter how fast I
>> do it) would expire the server connection?
>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20160430/d4046bca/attachment.htm>
More information about the zeromq-dev
mailing list