Ticket #1883 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Threading issue with OGR MI_TAB driver

Reported by: ksgeograf Assigned to: warmerdam
Priority: normal Milestone: 1.4.3
Component: OGR_SF Version: 1.4.2
Severity: normal Keywords: mitab threading
Cc: dmorissette

Description

I have discovered and fixed a problem with the MI_TAB part of OGR. The problem occurs when OGR is used in a threaded environment (such as the MapGuide? Server).

In mitab_datfile.cpp the functions ReadCharField? and ReadDateField? both use a static allocated buffer to return the results. This causes memory violations when one thread is reading the buffer and another is writing it.

The fix is simple, just add a member variable that can act as buffer, and remove the statically allocated buffers. This gives a slight overhead in memory consumption, but enables threading.

The attached DIFF file can be used to patch the gdal/ogr version found in the MapGudie? Server svn trunk (don't now the exact version used there).

Attachments

OGR TAB ThreadFix.diff (2.4 kB) - added by ksgeograf on 10/03/07 07:01:19.
Diff file, to be used against the MapGuide? Server Trunk version

Change History

10/03/07 07:01:19 changed by ksgeograf

  • attachment OGR TAB ThreadFix.diff added.

Diff file, to be used against the MapGuide? Server Trunk version

10/03/07 11:07:45 changed by warmerdam

  • cc set to dmorissette.
  • status changed from new to assigned.

I'll take care of this in OGR and upstream in MITAB when I get back tomorrow.

10/09/07 13:47:58 changed by warmerdam

  • status changed from assigned to closed.
  • resolution set to fixed.

Applied upstream in MITAB, so it should appear in MITAB 1.6.3-beta2.

gdal/ogr/ogrsf_frmts/mitab in trunk refreshed from upstream as r12358.

Minimal patch applied in 1.4 branch as r12359.