Opened 17 years ago

Closed 17 years ago

#1977 closed defect (fixed)

OGR support is not threadsafe in MapServer

Reported by: matthew@… Owned by: warmerdam
Priority: high Milestone: 5.0 release
Component: OGR Support Version: 5.0
Severity: normal Keywords: threads
Cc: dmorissette

Description (last modified by dmorissette)

When using MapServer in a multi-threaded application (such as an ASP.NET
application) ORG is not thread safe during operations that access the same data. 

MapServer seems to be a lot "more" thread safe with shapefiles, which leads me
to believe that the issue is with OGR.

Change History (5)

comment:1 by fwarmerdam, 17 years ago

Status: newassigned
Generally speaking OGR is not considered thread safe, and there are some 
very serious and well known thread safety issues with the GetFieldAsString()
method on the OGRFeature. 

There needs to be a "big lock" around OGR in MapServer similar to the one
already implemented around GDAL. 

I'll try and implement this before MapServer 5.0 release. 

comment:2 by szekerest, 17 years ago

> Generally speaking OGR is not considered thread safe, and there are some 
> very serious and well known thread safety issues with the GetFieldAsString()
> method on the OGRFeature.

This issue has been fixed when GDAL RFC 6 was applied. But I'm sure it was not
the only problem to be handled.

> There needs to be a "big lock" around OGR in MapServer similar to the one
> already implemented around GDAL.

It should be considered as a makeshift for now, and the usage of the static
variables in OGR should be reconsidered in the future.

comment:3 by dmorissette, 17 years ago

Cc: dmorissette added
Description: modified (diff)
Milestone: 5.0 release

comment:4 by warmerdam, 17 years ago

Keywords: threads added

I have introduced TLOCK_OGR and added use of it in mapogr.cpp in trunk (r6656 and r6657).

Proceeding to testing phase. I will also be working with Tamas on C# test app for multi-threaded rendering.

comment:5 by warmerdam, 17 years ago

Resolution: fixed
Status: assignedclosed

I have done some validation with a client provided test suite and things seem good.

Closing.

Note: See TracTickets for help on using tickets.