I found the issue!!
It is a Solaris compiler bug:
Actually Solaris doesn't handle correctly bit fields in C. This is the case of
the struct pn_collector_t (bool head_returned:1).
This caused the "collector->head_returned" to never be set to true in
pn_collector_next.
By removing the ":1", all the tests are green.
I will submit a pretty patch for the Solaris case once I have it finished.
Should I expect the same problem in other classes/structs?
Simple code to reproduce
----------------------------------
#include <stdio.h>
#include <stdbool.h>
struct myStruct {
bool dummy:1;
bool headReturned:1;
};
main() {
struct myStruct s;
s.headReturned = true;
fprintf(stderr, "---> headReturned = %d\n", s.headReturned);
}
Output : ---> headReturned = 0
Regards,
Adel
________________________________
From: Adel Boutros <[email protected]>
Sent: Wednesday, January 4, 2017 12:31:53 PM
To: [email protected]
Subject: Re: [Proton 0.16.0] [Solaris] Unit tests hanging when destroying
connection_driver
PS: The title of the mail is a bit misleading. It can be resumed as follows
"Unit tests hanging in proton-c"
________________________________
From: Adel Boutros <[email protected]>
Sent: Wednesday, January 4, 2017 12:27:17 PM
To: [email protected]
Subject: [Proton 0.16.0] [Solaris] Unit tests hanging when destroying
connection_driver
Hello,
I am compiling Proton 0.16.0 on Solaris using SunStudio compiler. The compiler
is successful however unit tests are hanging (cpp_thread_safe_test,
cpp_container_test, c-refcount-tests, c-reactor-tests, , cpp-example-container).
All tests except cpp-example-container seem to have the same failure. I am
willing to debug this further if needed but maybe you guys already have some
hints at why it might be hanging (I tend to think there is an object not added
or destroyed correctly and this its reference is not being incremented or
decremented).
Debugging analysis so far:
* c-refcount-tests: The hanging is occurring when calling the first drain in
test_collector_connection_transport ( drain(collector) )
* cpp_thread_safe_test: The hanging is occurring when calling the last assert
in test_new ( ASSERT_EQUAL(1, pn_refcount(c)) )
Failures with stack (pstack $PID | c++filt)
=================================
c-refcounts-tests
------------------------
fffffd7fff2efd87 pn_collector_next () + 2f
00000000004023e2 drain () + 1e
0000000000402464 test_collector_connection_transport () + 74
00000000004027f5 main () + 45
00000000004014bc ???????? ()
c-reactor-tests
------------------------
fffffd7fff2ef8f1 pn_collector_drain () + 3d
fffffd7fff2efbd7 pn_collector_release () + 57
fffffd7fff30025a pn_reactor_run () + 6e
0000000000402b4b test_reactor_event_root () + 63
00000000004038d2 main () + e
00000000004023ac ???????? ()
c-event-tests
------------------------
fffffd7fff2efda1 pn_collector_next () + 49
fffffd7fff2ef8f9 pn_collector_drain () + 45
fffffd7fff2ef9a5 pn_collector_finalize () + 11
fffffd7fff2efa7d pn_collector_finalize_cast () + 9
fffffd7fff2ded19 pn_class_decref () + 6d
fffffd7fff2dedee pn_class_free () + aa
fffffd7fff2df1c7 pn_free () + 13
00000000004011ad test_collector_put () + 65
00000000004014ee main () + e
0000000000400fbc ???????? ()
cpp_thread_safe_test
------------------------
fffffd7fff27fd95 pn_collector_next () + 3d
fffffd7fff27f8f9 pn_collector_drain () + 45
fffffd7fff27fbd7 pn_collector_release () + 57
fffffd7fff27fb68 pn_collector_free () + 38
fffffd7fff27a448 pn_connection_driver_destroy () + 44
fffffd7fff3139d9 proton::io::connection_driver::~connection_driver #Nvariant
1() () + d
0000000000403c79 void __unnamed_KkRMcLMNbYEgR::test_new() () + 4a5
00000000004048f2 main () + 3a
000000000040362c ???????? ()
cpp_container_test
------------------------
fffffd7fff27fd95 pn_collector_next () + 3d
fffffd7fff27f8f9 pn_collector_drain () + 45
fffffd7fff27fbd7 pn_collector_release () + 57
fffffd7fff29025a pn_reactor_run () + 6e
fffffd7fff31a674 void proton::reactor::run() () + c
fffffd7fff30aa97 void proton::container::impl::run() () + 17
fffffd7fff308560 void proton::container::run() () + c
00000000004061b1 int __unnamed_KkRMcLdNbYEzd::test_container_vhost() () + 1ad
0000000000407bb8 main () + 18
0000000000405bec ???????? ()
cpp-example-container
------------------------
fffffd7ffef12dca waitid (0, 2099, fffffd7fffdfe3b0, 3)
fffffd7ffef00f5b waitpid () + 7b
fffffd7fff2c7b76 posix_waitpid () + 46
fffffd7fff285aa3 PyEval_EvalFrameEx () + 5643
fffffd7fff287eba PyEval_EvalCodeEx () + 78a
fffffd7fff2863bc PyEval_EvalFrameEx () + 5f5c
fffffd7fff286e50 PyEval_EvalFrameEx () + 69f0
fffffd7fff287eba PyEval_EvalCodeEx () + 78a
fffffd7fff2863bc PyEval_EvalFrameEx () + 5f5c
fffffd7fff287eba PyEval_EvalCodeEx () + 78a
fffffd7fff288066 PyEval_EvalCode () + 36
fffffd7fff2aa8df PyRun_FileExFlags () + 9f
fffffd7fff2ab800 PyRun_SimpleFileExFlags () + 1c0
fffffd7fff2c0710 Py_Main () + a90
0000000000400a0c _start () + 6c
Regards,
Adel