Trapping JNI errors

Discussion in 'Java' started by Aaron Fude, Jun 1, 2004.

  1. Aaron Fude

    Aaron Fude Guest

    Hi,

    Is it possible to trap these to prevent the program from crashing?

    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at
    PC=0x899A836
    Function=Java_mush_MyClass_myFunction+0x19572


    Thanks!
    Aaron Fude, Jun 1, 2004
    #1
    1. Advertising

  2. On Tue, 1 Jun 2004 17:05:16 -0400, Aaron Fude wrote:
    > Is it possible to trap these to prevent the program from crashing?
    >
    > An unexpected exception has been detected in native code outside the VM.
    > Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at
    > PC=0x899A836
    > Function=Java_mush_MyClass_myFunction+0x19572


    No, and you really don't want to either.

    There is a serious error in your program. You have a corrupt pointer
    somewhere. Continuing as though nothing were wrong will likely only
    make things worse.

    It's like saying that there is a funny banging noise coming from your
    brakes, and rather than force the driver to stop, you're looking for a
    way to stop the noise from bothering him.

    You'll find some clues here:
    http://www.eskimo.com/~scs/C-faq/q16.8.html

    If it isn't too long, post the native method where the error occurs.

    /gordon

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
    Gordon Beaton, Jun 2, 2004
    #2
    1. Advertising

  3. Aaron Fude

    Aaron Fude Guest

    "Gordon Beaton" <> wrote in message
    news:40bd731f$...
    > On Tue, 1 Jun 2004 17:05:16 -0400, Aaron Fude wrote:
    > > Is it possible to trap these to prevent the program from crashing?
    > >
    > > An unexpected exception has been detected in native code outside the VM.
    > > Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at
    > > PC=0x899A836
    > > Function=Java_mush_MyClass_myFunction+0x19572

    >
    > No, and you really don't want to either.
    >
    > There is a serious error in your program. You have a corrupt pointer
    > somewhere. Continuing as though nothing were wrong will likely only
    > make things worse.


    Yes, there's a serious problem - but it's not my program! It is somebody
    elses program and I use it. It has a funny bug which makes it crash every
    100000th time it is used (there's a random component). If I can just say "ok
    you made an error, I will swallow it and let you try again" I will be able
    to keep my java simulations going. As it is, my java crashes along with the
    jni method.

    >
    > It's like saying that there is a funny banging noise coming from your
    > brakes, and rather than force the driver to stop, you're looking for a
    > way to stop the noise from bothering him.
    >
    > You'll find some clues here:
    > http://www.eskimo.com/~scs/C-faq/q16.8.html
    >
    > If it isn't too long, post the native method where the error occurs.
    >
    > /gordon
    >
    > --
    > [ do not email me copies of your followups ]
    > g o r d o n + n e w s @ b a l d e r 1 3 . s e
    Aaron Fude, Jun 2, 2004
    #3
  4. On Wed, 2 Jun 2004 04:02:51 -0400, Aaron Fude wrote:
    > "Gordon Beaton" <> wrote in message
    >> On Tue, 1 Jun 2004 17:05:16 -0400, Aaron Fude wrote:


    >>> Is it possible to trap these to prevent the program from crashing?
    >>>
    >>> An unexpected exception has been detected in native code outside the VM.

    ....
    >> No, and you really don't want to either.

    ....
    > Yes, there's a serious problem - but it's not my program! It is somebody
    > elses program and I use it.


    I think you might be able to extend
    what Gordon said to add.

    ...then you will need to approach the
    author of the 'seriously problematic'
    program for a fixed version.

    [ My apologies, Gordon, if I got that wrong. ]

    (& could I ask you to trim quotes to the minimum
    neded to provide context Aaron? It would help
    drop the bandwidth necessary to read the group
    if we all did it.)

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology
    Andrew Thompson, Jun 2, 2004
    #4
  5. On Wed, 2 Jun 2004 04:02:51 -0400, Aaron Fude wrote:
    > Yes, there's a serious problem - but it's not my program! It is
    > somebody elses program and I use it. It has a funny bug which makes
    > it crash every 100000th time it is used (there's a random
    > component). If I can just say "ok you made an error, I will swallow
    > it and let you try again" I will be able to keep my java simulations
    > going. As it is, my java crashes along with the jni method.


    Ok lets say you could ignore the error and continue. But you've got a
    stray pointer, and you don't know how it got there. What is extremely
    likely is that other variables and possibly the program stack have
    also been corrupted. That stray pointer could just as well have
    pointed somewhere into a valid data segment in the process, and made
    subtle changes there *without* causing a segmentation fault (yet).

    Can you trust the program to behave properly after that?

    Can you trust *any* return values from that method?

    Would you fly in that aircraft, or transfer money from your account in
    that bank?

    I would put pressure on the author of the native method, or spend my
    money elsewhere.

    /gordon

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
    Gordon Beaton, Jun 2, 2004
    #5
    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. =?Utf-8?B?QmlsbA==?=

    Trapping 'compile' errors when aspx page is rendered.

    =?Utf-8?B?QmlsbA==?=, Mar 29, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    506
    =?Utf-8?B?QmlsbA==?=
    Mar 29, 2005
  2. Avi Kak
    Replies:
    6
    Views:
    311
    Duncan Booth
    Feb 13, 2006
  3. Eitan

    Trapping errors in ASP

    Eitan, Jan 12, 2005, in forum: ASP General
    Replies:
    6
    Views:
    125
    Bob Barrows [MVP]
    Jan 13, 2005
  4. Eitan
    Replies:
    3
    Views:
    128
    Bob Barrows [MVP]
    Jan 12, 2005
  5. Gerard A.W. Vreeswijk

    trapping compile time errors

    Gerard A.W. Vreeswijk, Jul 7, 2003, in forum: Ruby
    Replies:
    5
    Views:
    130
    Robert Klemme
    Jul 7, 2003
Loading...

Share This Page