Segmentation fault only on Iinux

K

Kiran

Hello All,
In my program, I have a main thread which is the GUI (wxPython) and
then a thread which goes and reads data from a socket. The reason this
is in a different thread is because the data might take some time to
come back, and I want to have the GUI to be responsive during this
wait.

When I run my program in Linux, a segmentation fault occurs. When I
run it in Windows XP, it works just fine.

The main thing that would be of interest is as follows:
The segmentation fault does NOT occur if I disable the threads and
read the data all in 1 thread (the main thread [gui's]). This leads me
to believe it is some sort of threading problem related to linux.
However, I personally dont think that it can be something wrong with my
code, since my program runs perfectly fine in WindowsXP. I am also
carefully protecting data that my threads share with the MainGUI using
a Queue and also a semaphore lock.

I know this is kind of hard to answer without any code, but would
anybody know of some kind of issue such as this where there is some
threading problems with Linux and not Windows. I am happy to send the
code to anybody who wishes to see it. I havent posted it here because
it is kind of lengthy.

Also, I should note that I think we are running Linux Kernel 2.4

thanks a lot for your help,
Kiran
 
F

faulkner

if you don't know exactly which line of code causes the segfault, use
print statements to determine that. then try to either
redesign/refactor so that line isn't necessary, or protect its
operation somehow.
if you do know, tell us what it is and we might not need to see all
your code.
 
F

Frank Millman

Kiran said:
Hello All,
In my program, I have a main thread which is the GUI (wxPython) and
then a thread which goes and reads data from a socket. The reason this
is in a different thread is because the data might take some time to
come back, and I want to have the GUI to be responsive during this
wait.

When I run my program in Linux, a segmentation fault occurs. When I
run it in Windows XP, it works just fine.

Are you doing any xml processing? If so, it may be the same problem as
described in this recent post -

http://tinyurl.com/l3nr7

Frank Millman
 
K

Kiran

Unfortunately (i guess), I am not doing any XML. However, I am taking
the previous suggestion of putting print lines in every other line of
my code and then seeing where it crashes. Hopefully, that will solve
the problem.

thanks for the suggestions everybody
-- Kiran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top