#6809 closed defect (fixed)
Random crashes JPIP in multi-tread environment
Reported by: | bugbuster | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | 2.0.2 |
Severity: | normal | Keywords: | |
Cc: |
Description
We have run into random crashes when using JPIP images in a multi-thtread environment. After some tedious debug/logging activities( I am definitely not a multi-thread guru :-) ), I found out where the crash comes from. In the JPIP image destructor (JPIPKAKDataset::~JPIPKAKDataset()) :
- we call the function CPLHTTPCleanup(),
- in turn, this function calls curl_easy_cleanup() on all Curl handles.
In the JPIPKAKDataset destructor, we should only clean our own handle. I proposed a patch which applies to the file jpipkakdataset.cpp only.
However, I do not feel completely satisfied by this. Since I added a direct call to curl_easy_cleanup(), the JPIP plugin has a direct dependency to libCurl.
Shouldn't it better better to do the following :
- add a new function CPLHTTPCleanup2(CURL* myHandle) to cpl_http.cpp,
- use this new function in ~JPIPKAKDataset().
Attachments (2)
Change History (7)
by , 8 years ago
Attachment: | patch_jpip_multi_thread.txt added |
---|
comment:1 by , 8 years ago
Have a look at ogr/ogrsf_frmts/plscenes/ogrplscenesdataset.cpp for example and OGRPLScenesDataset::~OGRPLScenesDataset() with the CLOSE_PERSISTENT option passed to CPLHTTPFetch()
comment:2 by , 8 years ago
Hi Even,
I have been away from office last week and couldn't answer before. Thanks a lot for your hint. I modified my proposed patch to use the more generic CPLHTTPFetch() I/F. As you can see, I didn't create a new attribute to the JPIPKAKDataset class : instead, I used pszTid, which is declared as an attribute but never used.
by , 8 years ago
Attachment: | patch_GdalTicket6809.patch added |
---|
comment:4 by , 8 years ago
I've committed a simpler version of your patch in r37431 that doesn't need pszTid (which no longer exists in trunk nor 2.1 branch). I could only verify it compiles but have no way to check runtime behaviour. So please check.
patch to jpipkakdataset.cpp