Ticket #354 (new defect)

Opened 2 months ago

Last modified 2 months ago

PostGIS Defect : cursor name conflict make provider crash

Reported by: bscott Assigned to: mloskot
Priority: blocker Milestone: 3.4.0
Component: PostGIS Provider Version: 3.2.0
Severity: 1 Keywords:
Cc: External ID:

Description

the CreateCursor? function uses a fixed string + the current date and time for a unique cursor name. I have found many cases where 2 or more cursor are created in the same second, so the provider crashes with the "Cursor already exist" PostGIS message.

Adding a random number at the end of the unique cursor name calculation should resolve this issue.

Change History

07/02/08 12:56:21 changed by jbirch

This problem was also addressed in #116 by adding more granularity to the time measure. Did this get reverted when the dependancy on the boost time library was removed, or are you seeing conflicts at the microsecond level? Regardless, the potential for conflict still exists regardless of the time interval used.

What are you planning to use as the random seed? Is there some kind of identifier available that is already unique for each query?

(follow-up: ↓ 3 ) 07/02/08 13:52:13 changed by jbirch

Wow, I really am a dork. Can't believe I managed to use regardless twice in the same sentence.

(in reply to: ↑ 2 ) 07/03/08 04:12:01 changed by bscott

Before the boostdatetime dependency removal we had a millisecond based cursor name, i've changed it for a similar algo having the date + hour + minute + second + clock() where clock is millisecond based. But we still have cursor name conflict. I suggest this date + hour + minute + second + clock() + rand() without any seeds. The only way of having the same cursor name is to start 2 mapguide server and initialise there FIRST connection to PostGIS at the same millisecond.

It's still not 100% safe but it's really safer , dividing the probalitity of a clash by RAND_MAX(32767)