Segmentation fault only on Iinux

Discussion in 'Python' started by Kiran, Jun 20, 2006.

  1. Kiran

    Kiran Guest

    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
     
    Kiran, Jun 20, 2006
    #1
    1. Advertising

  2. Kiran

    faulkner Guest

    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
     
    faulkner, Jun 21, 2006
    #2
    1. Advertising

  3. 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
     
    Frank Millman, Jun 21, 2006
    #3
  4. Kiran

    Kiran Guest

    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
     
    Kiran, Jun 21, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Hunsley
    Replies:
    17
    Views:
    896
  2. Pud
    Replies:
    0
    Views:
    608
  3. Replies:
    0
    Views:
    574
  4. Ivan Vecerina
    Replies:
    0
    Views:
    507
    Ivan Vecerina
    Jun 29, 2003
  5. Vasileios Zografos

    Re: segmentation fault exception handling

    Vasileios Zografos, Jun 30, 2003, in forum: C++
    Replies:
    5
    Views:
    15,749
    Pete Becker
    Jul 1, 2003
Loading...

Share This Page