Flac Map error on write

Issue #175 resolved
IJabz repo owner created an issue

Underlying exception is hidden

11/11/2016 08.13.09:GMT:com.jthink.songkong.analyse.analyser.SongSaver:realSave:SEVERE: H:\songkong\CDGIM046\CDGIM046-02-Missa Corona spinea 02. Gloria Qui tollis.flac:Map failed org.jaudiotagger.audio.exceptions.CannotWriteException: H:\songkong\CDGIM046\CDGIM046-02-Missa Corona spinea 02. Gloria Qui tollis.flac:Map failed at org.jaudiotagger.audio.flac.FlacTagWriter.write(FlacTagWriter.java:200) at org.jaudiotagger.audio.flac.FlacFileWriter.writeTag(FlacFileWriter.java:43) at org.jaudiotagger.audio.generic.AudioFileWriter2.write(AudioFileWriter2.java:73) at org.jaudiotagger.audio.AudioFileIO.writeFile(AudioFileIO.java:488) at org.jaudiotagger.audio.AudioFileIO.write(AudioFileIO.java:211) at org.jaudiotagger.audio.AudioFile.commit(AudioFile.java:133) at com.jthink.songkong.analyse.analyser.SongSaver.realSave(SongSaver.java:822) at com.jthink.songkong.analyse.analyser.SongSaver.saveSongToFile(SongSaver.java:646) at com.jthink.songkong.analyse.analyser.SongSaver.saveChanges(SongSaver.java:189) at com.jthink.songkong.analyse.analyser.SongSaver.call(SongSaver.java:164) at com.jthink.songkong.analyse.analyser.SongSaver.call(SongSaver.java:58) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

Comments (6)

  1. IJabz reporter

    Done a (Interim) fix to catch exception and if fails try and rewrite using heap memory instead of system memory. However if large file will require a big lump of heap memory the same size as the audio length, so this should be rewritten more cleverly, work out extra space required, write this empty space, then write audio to new location in chunks instead of in one go, then go back and write the new metadata in the unallocated space.

  2. Dan Gravell

    I was concerned that this change would seriously affect performance, especially across a network. I ran some tests on Linux and was pleased to see it's actually an improvement. Here're my findings:

    All write times are an average of three runs.

    ##Using Mapped Byte Buffer...

    ###Local file

    FLAC file size: 24178 KB
    Artwork file size: 4720 KB
    Write took 76 millis
    
    FLAC file size: 236496 KB
    Artwork file size: 4720 KB
    Write took 211 millis
    

    ###File on network 100MB network, NFS config: rw,relatime,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys

    FLAC file size: 24172 KB
    Artwork file size: 4720 KB
    Write took 5573 millis
    
    FLAC file size: 236496 KB
    Artwork file size: 4720 KB
    Write took 36488 millis
    

    ##Using the new chunks approach...

    ###Local file FLAC file size: 24178 KB Artwork file size: 4720 KB Write took 59 millis

    FLAC file size: 236496 KB
    Artwork file size: 4720 KB
    Write took 258 millis
    

    ###File on network FLAC file size: 24172 KB Artwork file size: 4720 KB Write took 2946 millis

    FLAC file size: 236496 KB
    Artwork file size: 4720 KB
    Write took 22886 millis
    
  3. Log in to comment