Streampunk / beamcoder

Node.js native bindings to FFmpeg.
GNU General Public License v3.0
399 stars 76 forks source link

crash with "pointer being freed was not allocated" #13

Closed wacky6 closed 5 years ago

wacky6 commented 5 years ago

When using demuxStream, node crashes after reading some packets.

node(37174,0x700007087000) malloc: *** error for object 0x10ac00000: pointer being freed was not allocated
node(37174,0x700007087000) malloc: *** set a breakpoint in malloc_error_break to debug

Beamcoder: 0.3.1 Node.js: 12.4.0 Happens on macOS 10.14.5 and Ubuntu 18.04.1 LTS

Sample code:

const fs = require('fs')
const beamcoder = require('beamcoder')

;(async function() {
    const rs = fs.createReadStream(/* a local media file  */)
    const demuxStream = await beamcoder.demuxerStream({ highwaterMark: 8*1024*1024 })
    rs.pipe(demuxStream)

    const demux = await demuxStream.demuxer()
    let packet = null
    while (packet = await demux.read()) {
        console.log('p')
    }
})()

Maybe it's related to https://github.com/Streampunk/beamcoder/issues/8 ? Maybe it's introduced by https://github.com/Streampunk/beamcoder/commit/ceae1ebe04775d6db14abb0d436e8ed4b7b986c1 , this issue does not occur in 0.2.0

scriptorian commented 5 years ago

Please could you retest and let me know ?

wacky6 commented 5 years ago

Confirm this issue is fixed, closing this issue.

Nice work.