[CoreLab] Session state problem : primary key error

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
clemox
Posts: 3
Joined: Fri 21 May 2010 07:58

[CoreLab] Session state problem : primary key error

Post by clemox » Fri 21 May 2010 09:23

Hello,

I have a web farm with 2 servers (load balancing).
I use CoreLab (4.50.30.0) session state provider for Oracle 10g.

Overall, the session persistence works.
But sometimes, an error occurs.


Error description :

Exception information:
Exception type: OracleException
Exception message: ORA-00001: unique constraint (ORACLE.ASPNET_SESSIONS_SESSIONID_PK) violated

Request information:
Request URL: ******
User host address: ******
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE

Thread information:
Thread ID: 5
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: True
Stack trace: at CoreLab.Common.Web.Providers.DbSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem)
at System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Web.Config data :












After analysis of SetAndReleaseItemExclusive method (with reflector), a SQL request must delete my session :
"DELETE FROM aspnet_sessions WHERE sessionid = :sessionid AND LOWER(applicationname) = :applicationname AND expires SQL request does not delete my session.

Can you explain why this error occurs ? And what is the solution ?
Is this problem would be fixed in the new version of dotConnect for Oracle ?

Thank you very much.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 27 May 2010 13:20

Could you please send us a small test project so that we are able to reproduce and ivestigate the problem?

clemox
Posts: 3
Joined: Fri 21 May 2010 07:58

Post by clemox » Wed 30 Jun 2010 09:36

Sorry for the late reply.

I don't think a test project is interesting because problem doesn't occur constantly.

I think the problem is the parameter "regenerateExpiredSessionId" which is set to "true".
So an existing Session ID can be reused for an other session ?
Do you know what is the exact use of this parameter ? (MSDN isn't very clear)
What do you think about this ?

clemox
Posts: 3
Joined: Fri 21 May 2010 07:58

Post by clemox » Wed 30 Jun 2010 12:51

I have found root

I have one domain name and 2 asp.net web site.
http://myDomain/binApp1/
http://myDomain/binApp2/

=> Asp.net generate the same session id for 2 applications.
(Session id is generated from domain name).

When I access to binApp1, a row is inserted into ASPNET_SESSIONS table.
When I access to binApp2, error occurs.
Why ?

Because ASPNET_SESSIONS primary key is SESSIONID column.
More, binApp1 and binApp2 have same session id, but different application name !

I suggest to set ASPNET_SESSIONS primary key on SESSIONID and APPLICATIONNAME columns.
I test it, and it works.

Why do you think about this ?

Thank you!

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 01 Jul 2010 10:30

This should be a solution to the problem. We will investigate the possibility of changing the web tables installation script so that the ASPNET_SESSIONS table primary key will consist of both SessionId and ApplicationName fields.

degas
Posts: 77
Joined: Mon 16 Feb 2009 18:36
Location: Argentina

Same problem

Post by degas » Thu 01 Jul 2010 20:09

I have the same problem with devart version 5.35.79. It would be great if you could tell us if this temporary solution works?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 05 Jul 2010 16:24

I cannot reproduce the mentioned problem with my IIS at the moment. A different session id is generated for every application deployed on IIS in my environment. We are investigating the issue. As Clemox mentioned, please try setting ASPNET_SESSIONS primary key on SESSIONID and APPLICATIONNAME columns.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 29 Jul 2010 13:10

We've released dotConnect for Oracle 5.70.152 which contains the fixed scripts that create the ASPNET_SESSIONS table. The key now consists of both SESSIONID and APPLICATIONNAME columns. The new build can be downloaded from
http://www.devart.com/dotconnect/oracle/download.html
(the trial version) or from Registered Users' Area (for users with active subscription):
http://secure.devart.com/

For more information on improvements and fixes available in the 5.70.152 version, please refer to
http://www.devart.com/forums/viewtopic.php?t=18588

Post Reply