Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 323880

Summary: "This is already a proxy session" exception on WLS 10.3.3 after explicitly rolling back the user transaction
Product: z_Archived Reporter: Pechkurov Andrey <a.pechkurov>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: andrei.ilitchev, eclipselink.orm-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
stacktrace
none
patch with two disabled tests
none
In WebLogicPlatform use getReleaseBuildVersion instead of getBuildVersion none

Description Pechkurov Andrey CLA 2010-08-28 02:32:47 EDT
Build Identifier: 20100323-r6872

Exception is connected with oracle proxy authentication for Oracle 10g DB on WLS 10.3.x. 

Isolated client session is used and before every session bean call an interceptor method is fired. This method sets oracle proxy properties for the session bean's Entity Manager.

Everything works fine but in some situations there will be "java.sql.SQLException: This is already a proxy session" exception for every session bean call. The only way to repair the app after this is to restart the WLS. Looks like WLS doesn't issue beforeCompletion callback and attempt to clear proxy session in afterCompletion callback fails because access to the connection no longer allowed after transaction is complete.

Stacktrace of the exception is attached.

Detailed discussion of the problem is here: http://forums.oracle.com/forums/thread.jspa?messageID=4530698

Reproducible: Always

Steps to Reproduce:
1. lock a row in some table from external to the app DB session and try to update this row from the app;
2. release the lock from external session;
3. you'll get "Internal Exception: java.sql.SQLException: This is already a proxy session" for you every session bean call

or

1. just explicitly roll back the user transaction and you'll get the exception
Comment 1 Pechkurov Andrey CLA 2010-08-28 03:09:09 EDT
Created attachment 177662 [details]
stacktrace

stacktrace
Comment 2 Andrei Ilitchev CLA 2010-09-03 15:48:28 EDT
Created attachment 178193 [details]
patch with two disabled tests

The core problem is in WLS and it will be fixed in WLS 10.3.4.
The current patch
1) Adds debug output to connection customizer;
2) Adds a check for already opened proxy session - that should work around some (but not all!) problems: the connection released into poll without clearing its proxy session will have its old proxy session closed before starting a new one. That should fix the problem reported by the bug filer (see ProxyAuthenticationServerTestSuite.testFlushRollback);
3) Added two commented out non-Eclipselink tests: testJtaDataSource and testNonJtaDataSource that illustrate the core (WLS) problem. The tests should be uncommented when the core bug is fixed in WLS 10.3.4.

All what's left here is to wait until the core WLS bug is fixed, then uncomment the tests and close the bug.
Comment 3 Andrei Ilitchev CLA 2010-09-03 16:00:15 EDT
Forgot to mention that the patch also includes change to WebLogicPlatform - it determines the version of WLS and clears statement cache only if it's required for proxy session support - which is before WLS 10.3.4.
Comment 4 Andrei Ilitchev CLA 2010-09-03 16:36:02 EDT
Checked the patch into both trunk (2.2) and 2.1.2
Comment 5 Andrei Ilitchev CLA 2010-09-27 16:06:57 EDT
Uncommented testJtaDataSource and testNonJtaDataSource: they now run only on
WLS 10.3.4, which now automatically closes proxy session before retuning connection to the pool. Moreover, it clears cached statements when open or close proxy session.
Comment 6 Andrei Ilitchev CLA 2010-10-06 14:22:46 EDT
Created attachment 180364 [details]
In WebLogicPlatform use getReleaseBuildVersion instead of getBuildVersion

In case no patch was applied to WLS both getBuildVersion and getReleaseBuildVersion return the same output that looks like:
WebLogic Server 10.3.3.0  Fri Apr 9 00:05:28 PDT 2010 1321401

If the patch has been applied then getReleaseBuildVersion still returns the same as without patch, but getBuildVersion returns only patch info, like:
WebLogic Server Temporary Patch for 10063883, 10173996 Tue Oct 05 11:53:05 PDT 2010

Switched form using getBuildVersion to getReleaseBuildVersion to always get the release version and therefore be able to compare versions correctly (see prev. postings).
Comment 7 Andrei Ilitchev CLA 2010-10-06 14:27:14 EDT
Checked the patch into both trunk (2.2) and 2.1.2
Comment 8 Eclipse Webmaster CLA 2022-06-09 10:30:45 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink