Menu

#66 Random failures with exit code 9.

v1.0 (example)
open
nobody
5
2020-07-29
2016-09-11
f2d2
No

Hello.

I've been using OptiPNG on a server (Debian) for some years, specifically ver.0.7.4, 0.7.5 and 0.7.6 built from tar.gz from optipng.sourceforge.net. The program is called from a web page script, all input files are:
1. 32-bit PNGs made by a standard JavaScript Canvas method and not supposed to be malformed.
2. Same files resized/converted to 8-bit by PHP.

Throughout these years some cases of exit code 9 were logged with both kind, and I could not find any certain conditions to reproduce it, or any more settings to get some clues.

A couple of cases:

Command line: "./optipng.exe" -fix "i/p/6/69c43d57c4e307c1fa776fb3bca661f8.png" 2>&1
Shell output:
[
    ** Processing: i/p/6/69c43d57c4e307c1fa776fb3bca661f8.png
    640x360 pixels, 4x8 bits/pixel, RGB+alpha
    Reducing image to 2x8 bits/pixel, grayscale+alpha
    Input IDAT size = 37762 bytes
    Input file size = 37867 bytes
    Trying:
      zc = 9  zm = 8  zs = 0  f = 0     IDAT size = 23648
      zc = 9  zm = 8  zs = 1  f = 0     IDAT size = 23260
      zc = 1  zm = 8  zs = 2  f = 0
      zc = 9  zm = 8  zs = 3  f = 0
      zc = 9  zm = 8  zs = 0  f = 5
]
Return code: 9
Command line: "./optipng.exe" -fix -v "i/p/2/22713e007b7c6a2f7f5c03c5299cfaad.png" 2>&1
Shell output: 
[
    OptiPNG version 0.7.6
    Copyright (C) 2001-2016 Cosmin Truta and the Contributing Authors.
    ** Processing: i/p/2/22713e007b7c6a2f7f5c03c5299cfaad.png
    1920x1280 pixels, 4x8 bits/pixel, RGB+alpha
    Reducing image to 3x8 bits/pixel, RGB
    Input IDAT size = 4246129 bytes
    Input file size = 4252402 bytes
    Trying:
      zc = 9  zm = 8  zs = 0  f = 0     IDAT size = 3807913
      zc = 9  zm = 8  zs = 1  f = 0     IDAT too big
      zc = 1  zm = 8  zs = 2  f = 0     IDAT too big
      zc = 9  zm = 8  zs = 3  f = 0
]
Return code: 9

After the above, no changes to files were made.

Command line: "./optipng.exe" -fix -v "i/p/a/a60e0db43f856d8d825dfdacb3650e16_res.png" 2>&1
Shell output: 
[
    OptiPNG version 0.7.6
    Copyright (C) 2001-2016 Cosmin Truta and the Contributing Authors.
    ** Processing: i/p/a/a60e0db43f856d8d825dfdacb3650e16_res.png
    640x613 pixels, 4x8 bits/pixel, RGB+alpha
    Reducing image to 3x8 bits/pixel, RGB
    Input IDAT size = 325345 bytes
    Input file size = 325870 bytes
    Trying:
      zc = 9  zm = 8  zs = 0  f = 0     IDAT size = 201764
      zc = 9  zm = 8  zs = 1  f = 0     IDAT too big
      zc = 1  zm = 8  zs = 2  f = 0     IDAT too big
      zc = 9  zm = 8  zs = 3  f = 0     IDAT too big
      zc = 9  zm = 8  zs = 0  f = 5     IDAT too big
      zc = 9  zm = 8  zs = 1  f = 5     IDAT too big
      zc = 1  zm = 8  zs = 2  f = 5     IDAT too big
      zc = 9  zm = 8  zs = 3  f = 5     IDAT too big
    Selecting parameters:
      zc = 9  zm = 8  zs = 0  f = 0     IDAT size = 201764
]
Return code: 9

And after the above, the file was 57344 bytes (some cases of 0 bytes were seen too), with original file nearby renamed to *.png.bak, possible to restore and re-run optimization.

Currently it's scripted to:
1. run with all default settings.
2. if that fails somehow, try -fix.
It was seen to fail at 1st run and succeed at 2nd on the same file in the same script call.

Filesizes, available free memory or being called by PHP, SSH or whatever don't seem to have any certain connection. All I can tell from the exit code is probably this:

0x01: The zlib too-far-back error existed in at least one chunk.
0x08: The file was truncated.

from optipng-0.7.5\src\libpng\contrib\tools\pngfix.c, but being not familiar with the source code, I don't see anything else to do with it.

Thank you all for your work on the program anyway, I'm finding it pretty flawless on a Windows desktop.

1 Attachments

Discussion

  • f2d2

    f2d2 - 2016-09-25

    2 weeks ago I have rearranged my web script routine to aggressively discard any image data (via imageDestroy function in PHP) right after the last point where it must be used, and have not seen any error from OptiPNG since then.

    Not that it says anything about the subject problem, or guarantees anything to work forever.

     
  • f2d2

    f2d2 - 2016-10-13

    Disregard the previous comment. Nothing was changed with that, except my log path (stupid me).
    The same error code 9 still continued to appear once in N days.

     
  • f2d2

    f2d2 - 2020-07-29

    Last time that i've seen this error was in 2018 and it was OptiPNG version 0.7.6.
    Seems like 0.7.7 does not have this problem.
    Zlib was updated according to history.txt, maybe that's why.

    It's OK to close this ticket.

     

Log in to post a comment.