Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.97
    • Fix Version/s: 1.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      Windows 7, Java 1.7.0.1, 0.97-Incubator

      Description

      The attached image is somehow corrupt (it still can be opened with IrfanView).

      Trying to read the image information with Sanselan.getImageInfo(file) results in an IOException.

      After this the image is still locked on the file system, and can't be deleted for example. I expected it to be immediately get unlocked on the file system, after the error occured.

      1. 380440_295155317172029_185275861493309_985773_37867068_n.bmp
        2.89 MB
        Adrian Moerchen
      2. finbugs.patch
        0.5 kB
        Adrian Moerchen

        Activity

        Adrian Moerchen created issue -
        Adrian Moerchen made changes -
        Field Original Value New Value
        Attachment 380440_295155317172029_185275861493309_985773_37867068_n.bmp [ 12514986 ]
        Adrian Moerchen made changes -
        Affects Version/s 0.97 [ 12319275 ]
        Affects Version/s 0.94-incubator [ 12313311 ]
        Environment Windows 7, Java 1.7.0.1 Windows 7, Java 1.7.0.1, 0.97-Incubator
        Hide
        Damjan Jovanovic added a comment -

        This probably happens because BmpImageParser.getImageInfo() calls byteSource.getInputStream() and never closes it, thus leaking that InputStream.

        It's easy to fix with a try/finally around that one line of code, but the entire project should be audited for such leaks.

        Show
        Damjan Jovanovic added a comment - This probably happens because BmpImageParser.getImageInfo() calls byteSource.getInputStream() and never closes it, thus leaking that InputStream. It's easy to fix with a try/finally around that one line of code, but the entire project should be audited for such leaks.
        Damjan Jovanovic made changes -
        Summary Faulty image will be locked on the file system Audit and fix resource leaks
        Hide
        Adrian Moerchen added a comment -

        I've recommend you to use Findbugs. I've attached a patch for you pom.xml. After applying the patch you can run mvn site. This will also generate the Findbugs analyses. There you can search for OS_OPEN_STREAM to find possible candidates where stream may left be open.

        For developent you could add Findbugs to Eclipse or whatever you use.

        Links:
        http://findbugs.sourceforge.net/
        http://mojo.codehaus.org/findbugs-maven-plugin/
        http://findbugs.sourceforge.net/manual/eclipse.html

        Btw. Is there a release date for the next version?

        Show
        Adrian Moerchen added a comment - I've recommend you to use Findbugs. I've attached a patch for you pom.xml . After applying the patch you can run mvn site . This will also generate the Findbugs analyses. There you can search for OS_OPEN_STREAM to find possible candidates where stream may left be open. For developent you could add Findbugs to Eclipse or whatever you use. Links: http://findbugs.sourceforge.net/ http://mojo.codehaus.org/findbugs-maven-plugin/ http://findbugs.sourceforge.net/manual/eclipse.html Btw. Is there a release date for the next version?
        Adrian Moerchen made changes -
        Attachment finbugs.patch [ 12515085 ]
        Hide
        Damjan Jovanovic added a comment -

        Thank you for your patch, that's a great Maven plugin. Sadly "mvn site" is broken at the moment due to http://jira.codehaus.org/browse/MCLIRR-36 - this being the second Maven plugin bug I am having to fix - so I can't use your patch yet.

        I want to release as soon as possible, but there's a lot left to do, including a rename of the project to "Apache Commons Imaging". Maybe by the end of Q1 2012.

        Show
        Damjan Jovanovic added a comment - Thank you for your patch, that's a great Maven plugin. Sadly "mvn site" is broken at the moment due to http://jira.codehaus.org/browse/MCLIRR-36 - this being the second Maven plugin bug I am having to fix - so I can't use your patch yet. I want to release as soon as possible, but there's a lot left to do, including a rename of the project to "Apache Commons Imaging". Maybe by the end of Q1 2012.
        Hide
        Damjan Jovanovic added a comment -

        Ok I've hacked MCLIRR to work, and committed your patch. Thank you for your contribution.

        It finds all kinds of problems, but doesn't find the resource leak in BmpImageParser . Maybe because ByteSource.getInputStream() returns the stream, and FindBugs can only find streams that leak within a method? Either way, I'll audit all the calls to ByteSource.getInputStream().

        Show
        Damjan Jovanovic added a comment - Ok I've hacked MCLIRR to work, and committed your patch. Thank you for your contribution. It finds all kinds of problems, but doesn't find the resource leak in BmpImageParser . Maybe because ByteSource.getInputStream() returns the stream, and FindBugs can only find streams that leak within a method? Either way, I'll audit all the calls to ByteSource.getInputStream().
        Hide
        Damjan Jovanovic added a comment -

        Audited and fixed all ByteSource.getInputStream() leaks in commit 1294807, resolving FIXED .

        Show
        Damjan Jovanovic added a comment - Audited and fixed all ByteSource.getInputStream() leaks in commit 1294807, resolving FIXED .
        Damjan Jovanovic made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.0 [ 12319273 ]
        Resolution Fixed [ 1 ]
        Tony Stevenson made changes -
        Project Commons Sanselan [ 12310720 ] Apache Commons Imaging [ 12313421 ]
        Key SANSELAN-63 IMAGING-47
        Affects Version/s 0.97 [ 12321263 ]
        Affects Version/s 0.97 [ 12319275 ]
        Fix Version/s 1.0 [ 12321262 ]
        Fix Version/s 1.0 [ 12319273 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        11d 5h 48m 1 Damjan Jovanovic 28/Feb/12 20:08

          People

          • Assignee:
            Unassigned
            Reporter:
            Adrian Moerchen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development