It is currently Thu Nov 23, 2017 11:48 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Strange issue with Slim Reader Writer lock.
PostPosted: Mon Oct 16, 2017 9:05 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Sep 22, 2010 1:50 am
Posts: 765
Location: Bradenton, FL
I am getting strange problems with PB 5.45 on Windows 2008 Server using Microsoft's Slim Reader Writer library. So far, I have been unable to recreate the problems, but they occur about one every two weeks. The error number does not appear to be one easily searched.

Here are some examples:
Code:
Error Message:   Unknown error code
Error Code:      C0000264
Code Address:    776E8078
Sourcecode line: 1885
Sourcecode file: M:\Development\PureBasic\Services\OTS_CADData_service.pb

Error Message:   Unknown error code
Error Code:      C0000264
Code Address:    776E8078
Sourcecode line: 1900
Sourcecode file: M:\Development\PureBasic\Services\OTS_CADData_service.pb


The lines are:
Code:
1875    Repeat
1876        WaitForSingleObject_(thisEvent(eventNumber), monitorTime)
1877        If shutDownNow
1878            Break
1879        EndIf
1880
1881 ; get the data from the list we have built
1882
1883         AcquireSRWLockShared(*runNumberUpdates)
1884         runListSize = ListSize(runUpdates())
1885         ReleaseSRWLockShared(*runNumberUpdates)
1886
1887         If runListSize = 0
1888             Continue
1889         EndIf
1890
1891         ClearList(updateList())
1892
1893         While Not TryAcquireSRWLockExclusive(*runNumberUpdates)
1894             Delay(100)
1895         Wend
1896
1897         CopyList(runUpdates(), updateList())
1898         ClearList(runUpdates())
1899
1900        ReleaseSRWLockExclusive(*runNumberUpdates)


The error happens on the release, afters thousands of successful releases. Does anyone have a clue as to what the error might be?? The service is about 6000 lines long with all of the includes.

Thanks!
Rich


Top
 Profile  
Reply with quote  
 Post subject: Re: Strange issue with Slim Reader Writer lock.
PostPosted: Tue Nov 14, 2017 12:40 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Sep 22, 2010 1:50 am
Posts: 765
Location: Bradenton, FL
May have found the issue with this, I have removed the ability to use 'AcquireSRW...' and will now only use the 'TryAcquire...' functions. I had assumed the 'AcquireSRW...' would block if unsuccessful. I am no longer sure this is the case.
Code:
; see if we are 64 bit or not

CompilerIf #PB_Processor_x64
    Import "..\Windows_libs\x64\kernel32.lib"
        InitializeSRWLock(*globalPointer)
        TryAcquireSRWLockShared(*globalPointer)
        ReleaseSRWLockShared(*globalPointer)
        TryAcquireSRWLockExclusive(*globalPointer)
        ReleaseSRWLockExclusive(*globalPointer)
    EndImport

; else we are 32 bit

CompilerElse
    Import "..\Windows_libs\x86\kernel32.lib"
        InitializeSRWLock(*globalPointer)
        TryAcquireSRWLockShared(*globalPointer)
        ReleaseSRWLockShared(*globalPointer)
        TryAcquireSRWLockExclusive(*globalPointer)
        ReleaseSRWLockExclusive(*globalPointer)
    EndImport
CompilerEndIf

Code:
While Not TryAcquireSRWLockShared(*globalPointer)
    Delay(20)
Wend
...
ReleaseSRWLockShared(*globalPointer)

While Not TryAcquireSRWLockExclusive(*globalPointer)
    Delay(50)
Wend
...
ReleaseSRWLockExclusive(*globalPointer)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye