Opened 16 years ago

Closed 16 years ago

#2408 closed defect (fixed)

Use of OpenShared() inappropriate in multi-thread case

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone: 5.0.1 release
Component: OGR Support Version: 5.0
Severity: normal Keywords: threading
Cc:

Description

For MapServer 5.0, the mapogr.cpp code was instrumented with locking to prevent concurrent calls into OGR. However, the previous assumption of mapogr.cpp was that operation was single threaded, so the OGR OpenShared() call was used to optimize file access by avoiding unnecessary re-reads. In a multi-threaded situation the same OGR file handle is used by all threads, and more than one thread drawing or otherwise querying a file will result in massive confusion on who gets what features.

The minimum workaround is to comment out "#define USE_SHARED_ACCESS". The better solution would be to utilize mappool services to manage shared OGR handles since it knows how to ensure this is done only a per-thread basis.

Change History (2)

comment:1 by warmerdam, 16 years ago

Status: newassigned

I have reworked mapogr.cpp to use the connection pooling API in r7085 (trunk), and introduced a modest test of deferred connections for OGR in msautotest (ogr_multi_defer.map) in msautotest (r7084).

I've referred the change for Matthew Lock to test, and if that goes well I hope to migrate it back into 5.0 branch.

comment:2 by warmerdam, 16 years ago

Resolution: fixed
Status: assignedclosed

I have migrated change into 5.0.x branch since Matthew doesn't expect to be able to test for a while (r7106).

Note: See TracTickets for help on using tickets.