Help - Search - Members - Calendar
Full Version: ASP.net sessions being deleted
The Planet Forums > System Administration > Web Hosting
mavstar
Hi all,

I've been noticing that since joining theplanet (dedicated server) that my website has been forcing people to login only after a couple of minutes. I know it's not a major issue, but i have users starting to complain about it.

i'm running plesk on windows server 2003 R2. I've set the session to 60 minutes in the web.config

From my brief googling i suspect it is the antivirus checker touching the web.config forcing ASP.net to recompile (hence deleting all sessions in proc).

Is there a way to confirm this is the cause?

Should i put health web events on in the web.config?

AND if it is the antivirus how do i tell it to NOT scan the website folder?
(the active Antivirus checker is Kaspersky)

Hope someone can shed some light on this issue

MavStar
thedude
QUOTE (mavstar @ Dec 5 2007, 07:33 PM) *
Hi all,

I've been noticing that since joining theplanet (dedicated server) that my website has been forcing people to login only after a couple of minutes. I know it's not a major issue, but i have users starting to complain about it.

i'm running plesk on windows server 2003 R2. I've set the session to 60 minutes in the web.config

From my brief googling i suspect it is the antivirus checker touching the web.config forcing ASP.net to recompile (hence deleting all sessions in proc).

Is there a way to confirm this is the cause?

Should i put health web events on in the web.config?

AND if it is the antivirus how do i tell it to NOT scan the website folder?
(the active Antivirus checker is Kaspersky)

Hope someone can shed some light on this issue

MavStar


You could always disable the firewall, then test. If the sessions stay up, then you know its the AV software.
mavstar
QUOTE (thedude @ Dec 6 2007, 01:10 PM) *
You could always disable the firewall, then test. If the sessions stay up, then you know its the AV software.


Good idea, i have turned off the a/v checker.

I'm still seeing the session cut short prematurely....

I think i will put the WebEvents on to capture if the application is restarting...

I'll keep this thread posted on how it goes.

MavStar
Gremlin
IIRC There was a Windows hotfix that addressed what sounds like a similar issue with W2K3 SP1 you might want to try MS KB for help also.
rabbit994
If WorkerProcess is recycling, it will blow out the sessions quickly if your running the sessions in proc. I would change from "inproc" to stateserver instead.

http://www.eggheadcafe.com/articles/20021016.asp

EDIT: unless the users are uploading stuff to server, I would consider turning off AV real time and possibly doing scanning on occasion.
mavstar
Further testing as concluded the following:

1. Anti-virus has had no effect on the session problem. It has been turned off for over a week and the problem persists.

2. Webevents (i.e. Application Life Time Events) logs a consist ten minute frequency to the application restarts

3. Guess who runs a background operation on a 10 minute frequency? (no points for guessing right!)

Yes that's right, MY background operation is causing the problem!!!!

No i have just got to work out why it is causing the problem.

I will paste the code shortly to see if anyone can spot the colpret

Mavstar
mavstar
This is the code which is triggered every 10 minutes. (it is triggered by a scheduled task)
The page which calls the code runs the StartTask sub on the Sceduler class, this spins off a Delegate thread which proceeds to load the tasks and run the items which are due to run. The tasks all execute without a drama, so i'm suspicious of how the process finishes which is at the end of ExecuteQueuedTasks. Should i be doing something to terminate the thread? I also wonder if it is the 'Shared' nature of the _TaskQueue...

Can anyone shed some light on this?

CODE
Public Class Scheduler

Public Shared _TaskQueue As New ArrayList()

Public Sub StartTask()
Try
TaskWorker.BeginInvoke(Nothing, Nothing)
Catch ex As Exception
Dim Message As New OurSettingsTableAdapters.MessagesTableAdapter
Message.Insert("Task Error", 1, ex.Message, False, Now.AddHours(Classes.TimeOffset), "Task Error", 0, 0, 0, 0)
Message.Dispose()
End Try
End Sub

Private Delegate Sub GetXMLDelegate()
Dim TaskWorker As New GetXMLDelegate(AddressOf ExecuteQueuedTasks)

Public Sub LoadTasks()
Dim Adaptor As New OurTasksTableAdapters.TasksTableAdapter
Dim Table As New OurTasks.TasksDataTable

Adaptor.FillNextTasks(Table, Now.AddHours(Classes.TimeOffset))

If Table.Rows.Count = 0 Then
Return
End If

For Each row As OurTasks.TasksRow In Table
Dim Task As New Task
Task.Load(row.TaskID, row.Task, row.Frequency, row.RunNext, row.Priority, row.AccountID, row.Comments)
_TaskQueue.Add(Task)
Next row
End Sub

Public Sub ExecuteQueuedTasks()
Dim Tasks As New ArrayList()

If _TaskQueue.Count = 0 Then
LoadTasks()
End If

' Collect which jobs are overdue
For Each Task As Task In _TaskQueue
If Task.RunNext <= DateTime.Now.AddHours(xtraparking.Classes.TimeOffset) Then
Tasks.Add(Task)
End If
Next Task

' Execute the jobs that are overdue
For Each Task As Task In Tasks
SyncLock _TaskQueue
Task.Execute()
_TaskQueue.Remove(Task)
End SyncLock
Next Task
End Sub

End Class
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.