Print Thread
Page 1 of 3 1 2 3
Application crash without exception on LogOff when busy
#6101 02/27/04 04:33 PM
Joined: Feb 2004
Posts: 41
R
Ralf Offline OP
Member
OP Offline
Member
R
Joined: Feb 2004
Posts: 41
Situation:
Table LOCKTEST with unique field TESTID.

From one session (for example SQL+) insert a record with TESTID=33 without commit.

Then from Delphi application with thread having a TOracleQuery do the same (insert record with TESTID=33). Then this thread hangs until the other session is committed.

If you don't commit the other thread and call OracleSession.LogOff in the hanging thread the application wil crash without any exception! The last debug line is a call to 'OCISessionEnd'.

Calling BreakExecution first doesn't make a difference.

Any ideas?

Re: Application crash without exception on LogOff when busy
#6102 02/27/04 08:23 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
Member
Joined: Aug 1999
Posts: 22,208
If TOracleSession.ThreadSafe = False in a multi-threaded application, you must be careful when you access the same session from different threads. Simultaneous access can lead to unpredictable results.

If a thread is waiting for a lock, then you do not have much control. Like you said, BreakExecution does not help (the Oracle Server does not respond in case of a lock). You can only wait until the lock is released.


Marco Kalter
Allround Automations
Re: Application crash without exception on LogOff when busy
#6103 02/27/04 08:27 PM
Joined: Feb 2004
Posts: 41
R
Ralf Offline OP
Member
OP Offline
Member
R
Joined: Feb 2004
Posts: 41
It's not the same session. The thread has its own TOracleSession. And what if the execution takes on for ever?? There must be a possibility to stop the execution.

Re: Application crash without exception on LogOff when busy
#6104 02/27/04 08:29 PM
Joined: Feb 2004
Posts: 41
R
Ralf Offline OP
Member
OP Offline
Member
R
Joined: Feb 2004
Posts: 41
I just use the thread to be able to access the oraclesession. If it is hanging in main thread, the application doesn't react at all.

So one session in a thread in a delphi application and the other session is through Oracle's SQL+.

The Oracle session in the thread has ThreadSafe=false because it isn't used by more threads.

Re: Application crash without exception on LogOff when busy
#6105 02/27/04 09:19 PM
Joined: Feb 2004
Posts: 41
R
Ralf Offline OP
Member
OP Offline
Member
R
Joined: Feb 2004
Posts: 41
I wrote a testproject:

Test Project

You must set the connection-info for the database and create the table as described in the top of unit1.pas.

You can add the record from SQL+ or with the button 'Add Record' that adds a record to the testtable. Then press the execute button, which inserts the same record in the same table with another session from a thread.

Re: Application crash without exception on LogOff when busy
#6106 03/01/04 10:47 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
Member
Joined: Aug 1999
Posts: 22,208
You cannot disconnect a session in the main thread that is currently executing in a background thread. All you can do is call TOracleSession.BreakExecution, and if that doesn't help, you have no real control over the session until execution finishes.


Marco Kalter
Allround Automations
Re: Application crash without exception on LogOff when busy
#6107 03/02/04 11:31 AM
Joined: Feb 2004
Posts: 41
R
Ralf Offline OP
Member
OP Offline
Member
R
Joined: Feb 2004
Posts: 41
OK, but why does my application crash when I call logoff??? It doesn't even show an exception in Delphi!

Re: Application crash without exception on LogOff when busy
#6108 03/02/04 10:44 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
Member
Joined: Aug 1999
Posts: 22,208
This is caused by the Oracle Call Interface DLL (oci.dll). Like I said, you cannot access a session from 2 different threads if ThreadSafe is false, this will lead to unpredictable results.


Marco Kalter
Allround Automations
Re: Application crash without exception on LogOff when busy
#6109 03/05/04 06:20 PM
Joined: Feb 2004
Posts: 41
R
Ralf Offline OP
Member
OP Offline
Member
R
Joined: Feb 2004
Posts: 41
Did you try my test project????
It uses 2 different sessions!!!
Then ThreadSafe isn't relevant according to your help:

Quote: "Multi-threaded, multi-session database access. No special properties need to be set, and session management is clear."

What am I missing??

Re: Application crash without exception on LogOff when busy
#6110 03/05/04 10:42 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
Member
Joined: Aug 1999
Posts: 22,208
I didn't notice that it uses multiple sessions. What exactly should I do in your application to reproduce the problem?


Marco Kalter
Allround Automations
Page 1 of 3 1 2 3

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.056s Queries: 14 (0.011s) Memory: 2.5568 MB (Peak: 3.0380 MB) Data Comp: Off Server Time: 2024-05-06 05:41:50 UTC
Valid HTML 5 and Valid CSS