Infinite backtrace of wxapp_poll_fun() while sending on socket from a thread to another  [SOLVED]

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
cminus
In need of some credit
In need of some credit
Posts: 9
Joined: Mon May 28, 2018 2:15 pm

Infinite backtrace of wxapp_poll_fun() while sending on socket from a thread to another

Postby cminus » Thu Jul 12, 2018 7:55 am

We have two components that run in separate processes fine and communicates over TCP socket.

We decided to merge both, that each component runs in a different thread and still communicates on the same TCP socket.
When using batch mode, it works great. But when launch our GUI main frame it crashes with the following backtrace

Code: Select all

#0  0x000000301060e450 in __lll_unlock_wake () from /lib64/libpthread.so.0
#1  0x000000301060a8f7 in _L_unlock_657   () from /lib64/libpthread.so.0
#2  0x000000301060a85f in pthread_mutex_unlock () from /lib64/libpthread.so.0
#3  0x00007ffff7944459 in wxMutexInternal::Unlock() () from /home/lib/wxWidgets2.8.10d_4.3.3_SUSE10/lib/libwx_gtk2-2.8.so.0
#4  0x00007ffff796c4ba in wxapp_poll_func () from /home/lib/wxWidgets2.8.10d_4.3.3_SUSE10/lib/libwx_gtk2-2.8.so.0
#5  0x00007ffff796c4d4 in wxapp_poll_func () from /home/lib/wxWidgets2.8.10d_4.3.3_SUSE10/lib/libwx_gtk2-2.8.so.0
#6  0x00007ffff796c4d4 in wxapp_poll_func () from /home/lib/wxWidgets2.8.10d_4.3.3_SUSE10/lib/libwx_gtk2-2.8.so.0
#7  0x00007ffff796c4d4 in wxapp_poll_func () from /home/lib/wxWidgets2.8.10d_4.3.3_SUSE10/lib/libwx_gtk2-2.8.so.0
#8  0x00007ffff796c4d4 in wxapp_poll_func () from /home/lib/wxWidgets2.8.10d_4.3.3_SUSE10/lib/libwx_gtk2-2.8.so.0
.
.
.


The last line is repeated over and over, I have tried to scroll multiple times, but I gave up after reaching 3000 repetitions.

To my knowledge, wxapp_poll_func is required by GTK for polling on file descriptors ( Not sure if corrected 100 %).

Notes:
* Platform : Linux, Compiler : g++ 4.7, Wxwidgets : 2.8.10

Any leads to follow or guides would be appreciated .

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2677
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Infinite backtrace of wxapp_poll_fun() while sending on socket from a thread to another

Postby ONEEYEMAN » Thu Jul 12, 2018 3:43 pm

Hi,
It looks like you are using wx-2.8. Did you try to update to 3.0/3.1?
It would also be nice to know where it crashes - produce a debug build of wx and your application (with symbols).

Thank you.

cminus
In need of some credit
In need of some credit
Posts: 9
Joined: Mon May 28, 2018 2:15 pm

Re: Infinite backtrace of wxapp_poll_fun() while sending on socket from a thread to another

Postby cminus » Sun Jul 15, 2018 10:33 am

ONEEYEMAN wrote:Hi,
It looks like you are using wx-2.8. Did you try to update to 3.0/3.1?
It would also be nice to know where it crashes - produce a debug build of wx and your application (with symbols).

Thank you.


Upgrading to Wx 3.0 is a dream, but it's not currently possible.

Debugging got me that it always crashes at calls to

Code: Select all

wxThread::Sleep(50);

DavidHart
Site Admin
Site Admin
Posts: 3765
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Infinite backtrace of wxapp_poll_fun() while sending on socket from a thread to another

Postby DavidHart » Sun Jul 15, 2018 11:40 am

Hi,

(I have little thread experience, but) By far the commonest reason for this sort of thing is directly touching the wx gui from a worker thread. Make sure that all contact between a thread and the gui is done by posting events, using e.g. wxPostEvent.

Regards,

David

User avatar
doublemax
Moderator
Moderator
Posts: 12680
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Infinite backtrace of wxapp_poll_fun() while sending on socket from a thread to another

Postby doublemax » Sun Jul 15, 2018 11:57 am

BTW: The function in question (wxapp_poll_func) does not exists any more in the GTK2 version of wx3.x.
Use the source, Luke!

cminus
In need of some credit
In need of some credit
Posts: 9
Joined: Mon May 28, 2018 2:15 pm

Re: Infinite backtrace of wxapp_poll_fun() while sending on socket from a thread to another  [SOLVED]

Postby cminus » Thu Jul 19, 2018 9:50 am

@DavidHart, for Sure I do this.

-----------------------
I found the issue, both components tries to Initialize Wx library using different function.

This led to this strange behavior.

I solved it by adding a condition checking if `wxTheApp` is NULL or no to allow the second initialization.

-----------------------
@doublemax, I really like your signature "Use The Source, Luke".

it's the thing that solved the issue

Thanks


Return to “Platform Related Issues”

Who is online

Users browsing this forum: No registered users and 0 guests