473,385 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Segmentation fault only on Iinux

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

Jun 20 '06 #1
3 1536
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.

Kiran wrote:
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


Jun 20 '06 #2

Kiran wrote:
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

Jun 21 '06 #3
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

Frank Millman wrote:
Kiran wrote:
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


Jun 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: sivignon | last post by:
Hi, I'm writing a php script which deals with 3 ORACLE databases. This script is launch by a script shell on an linux machine like this : /../php/bin/php ./MySript.php (PHP 4.3.3) My script...
3
by: diyanat | last post by:
i am writing a cgi script in C using the CGIC library, the script fails to run, i am using apache on linux error report from apache : internal server error Premature end of script headers:...
3
by: Zheng Da | last post by:
Program received signal SIGSEGV, Segmentation fault. 0x40093343 in _int_malloc () from /lib/tls/libc.so.6 (gdb) bt #0 0x40093343 in _int_malloc () from /lib/tls/libc.so.6 #1 0x40094c54 in malloc...
5
by: Fra-it | last post by:
Hi everybody, I'm trying to make the following code running properly, but I can't get rid of the "SEGMENTATION FAULT" error message when executing. Reading some messages posted earlier, I...
18
by: Digital Puer | last post by:
Hi, I'm coming over from Java to C++, so please bear with me. In C++, is there a way for me to use exceptions to catch segmentation faults (e.g. when I access a location off the end of an array)?...
27
by: Paminu | last post by:
I have a wierd problem. In my main function I print "test" as the first thing. But if I run the call to node_alloc AFTER the printf call I get a segmentation fault and test is not printed! ...
7
by: pycraze | last post by:
I would like to ask a question. How do one handle the exception due to Segmentation fault due to Python ? Our bit operations and arithmetic manipulations are written in C and to some of our...
3
by: madunix | last post by:
My Server is suffering bad lag (High Utlization) I am running on that server Oracle10g with apache_1.3.35/ php-4.4.2 Web visitors retrieve data from the web by php calls through oci cobnnection...
6
by: DanielJohnson | last post by:
int main() { printf("\n Hello World"); main; return 0; } This program terminate just after one loop while the second program goes on infinitely untill segmentation fault (core dumped) on...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.