BUG: png support (partially) not threadsafe.

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, xnview

Post Reply
User avatar
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

BUG: png support (partially) not threadsafe.

Post by MaierMan » Sun Feb 25, 2007 4:52 am

I experienced "cruel" results when I tried to process pngs in a multi-threaded application.
Seems it happens just with some png files while other reliably load.

Wrote a small test application to outline the issue.
http://tn123.ath.cx/gfl/png/
(code makes use of OpenMP and therefore require visual studio (2k5SP1) redist)

Sample pngs available too.
test-bad.png was created using XNView IIRC.
test-ok.png created by Ubuntu screen capture.


Try: e.g.

Code: Select all

gflpng.exe <numfiles <numthreads> <file>
gflpng.exe 100 5 test-bad.png
I tested on three different Systems (all WinXP Pro SP2 32Bit):
AMD Athlon64 X2
Core 2 Duo
Pentium III

Both dual core systems fail >90% of all loads.
That single core system fails <10%.
Using only one thread is always successful.

JPEG, BMP readers seem to work always; other readers not tested.

Conclusion
---
There is still *some* code in the png implementation that is not thread-safe. That code is not always triggered.

User avatar
xnview
Author of XnView
Posts: 32043
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: BUG: png support (partially) not threadsafe.

Post by xnview » Fri Mar 02, 2007 1:49 pm

MaierMan wrote:I experienced "cruel" results when I tried to process pngs in a multi-threaded application.
Seems it happens just with some png files while other reliably load.
So the problem is only reading? With which version?
Pierre.

User avatar
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Re: BUG: png support (partially) not threadsafe.

Post by MaierMan » Fri Mar 02, 2007 2:13 pm

xnview wrote:
MaierMan wrote:I experienced "cruel" results when I tried to process pngs in a multi-threaded application.
Seems it happens just with some png files while other reliably load.
So the problem is only reading? With which version?
I didn't test writing.

Should be obvious as I linked against libgfl267.dll. ;)
Side note: 266 is affected as well; other versions untested.

User avatar
xnview
Author of XnView
Posts: 32043
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: BUG: png support (partially) not threadsafe.

Post by xnview » Tue Mar 13, 2007 2:35 pm

MaierMan wrote:Should be obvious as I linked against libgfl267.dll. ;)
Side note: 266 is affected as well; other versions untested.
The multi thread code begin here

Code: Select all

for (int i = 0; i < files; ++i)
I don't know omp

And if you try from file?
Pierre.

User avatar
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Post by MaierMan » Fri Mar 30, 2007 11:49 pm

Any news?
Anything I can do to help?
Really gives me headaches.
I feel unconfortable shipping my (minor and unimportant) apps with this bug.
Furthermore I recently work a lot with pngs...

User avatar
xnview
Author of XnView
Posts: 32043
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post by xnview » Tue Apr 10, 2007 6:54 am

MaierMan wrote:Any news?
Anything I can do to help?
Really gives me headaches.
I feel unconfortable shipping my (minor and unimportant) apps with this bug.
Furthermore I recently work a lot with pngs...
Not yet, i don't find the problem....
Pierre.

User avatar
Ithier
Posts: 47
Joined: Fri Nov 19, 2004 10:50 am
Location: Paris, France
Contact:

Post by Ithier » Fri Jun 01, 2007 3:58 pm

Hi,

Is it the same problem that I had some time ago: http://newsgroup.xnview.com/viewtopic.php?t=3017. I haven't tested again, but I don't think it has been solved.

User avatar
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Post by MaierMan » Fri Jun 01, 2007 8:43 pm

Ithier wrote:Hi,

Is it the same problem that I had some time ago: http://newsgroup.xnview.com/viewtopic.php?t=3017. I haven't tested again, but I don't think it has been solved.
Totally forgot about this thread...

User avatar
xnview
Author of XnView
Posts: 32043
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post by xnview » Sat Jun 02, 2007 5:56 am

MaierMan wrote:
Ithier wrote:Hi,

Is it the same problem that I had some time ago: http://newsgroup.xnview.com/viewtopic.php?t=3017. I haven't tested again, but I don't think it has been solved.
Totally forgot about this thread...
I have now a dual core, so i'll be able to test...
Pierre.

User avatar
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Post by MaierMan » Tue Feb 19, 2008 9:00 pm

As announced in the other thread, here is the version without omp. Using regular win32 threads:
http://tn123.ath.cx/gfl/png/gflpng-noomp.zip

User avatar
xnview
Author of XnView
Posts: 32043
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post by xnview » Thu Feb 21, 2008 5:03 pm

I've tried the "gfl crash multi thread" test, and have the problem.

I've build GFL with the new libpng, and now seems that the problem is gone. Could you send me your email to send you a test version?
Pierre.

pber
Posts: 9
Joined: Tue Feb 26, 2008 5:27 pm

Post by pber » Fri Feb 29, 2008 10:05 am

I've also experienced that problem. Is it fixed with the 2.82 GFL lib?

User avatar
xnview
Author of XnView
Posts: 32043
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post by xnview » Fri Feb 29, 2008 10:58 am

pber wrote:I've also experienced that problem. Is it fixed with the 2.82 GFL lib?
yes
Pierre.

Post Reply