animetosho / ParPar

High performance PAR2 create client for NodeJS
190 stars 19 forks source link

Error running parpar on MacOS #34

Closed df-a closed 2 years ago

df-a commented 2 years ago

IHello there,

I'm on catalina btw. Every time I run parpar, I get an malloc error.

file.iso is a 2.1GB linuxmint iso. command parpar -s 1M -r 64 -o my_recovery.par2 file.iso

Result:

Multiply method used: XOR JIT (128 bit), 1 thread
Generating 64 MiB recovery data (64 slices) from 2061.98 MiB of data
ParPar(20553,0x11b65ddc0) malloc: Incorrect checksum for freed object 0x7faa02557f98: probably modified after being freed.
Corrupt value: 0x39b70000b4cb
ParPar(20553,0x11b65ddc0) malloc: *** set a breakpoint in malloc_error_break to debug
zsh: abort      parpar -s 1M -r 64 -o my_recovery.par2

command parpar -s 10M -r 500 -o my_recovery.par2 file.iso

Result:

Multiply method used: XOR JIT (128 bit), 1 thread
Generating 5000 MiB recovery data (500 slices) from 2061.98 MiB of data
ParPar(20785,0x117b0adc0) malloc: Incorrect checksum for freed object 0x7fa3c8452dd8: probably modified after being freed.
Corrupt value: 0xc3e900001e67
ParPar(20785,0x117b0adc0) malloc: *** set a breakpoint in malloc_error_break to debug
zsh: abort      parpar -s 10M -r 500 -o my_recovery.par2

It keeps aborting, giving me the same malloc: Incorrect checksum for freed object error. Of the resulting par2 files, my_recovery.par2 will be 0 bytes; the others claim to have "all files correct" when I open them but nothing shows up to check. Macpar shows empty when I open any of the par files, not showing the file.iso.

I'm on Catalina, parpar has been installed with npm.

df-a commented 2 years ago

Installing from source works.

Command: parpar.js -s 1M -r 500 -o my_recovery.par2 file.iso

Result:

Multiply method used: Xor-Jit (SSE2), 1 thread
Generating 500 MiB recovery data (500 slices) from 2061.98 MiB of data
Calculating:  39.76%

Something wrong with the npm package?

animetosho commented 2 years ago

Thanks for raising the issue. Unfortunately, MacOS is difficult for me to support as I don't have a Mac (have been using an old hackintosh image in a VM to test functionality). I might look at seeing if I can get a newer MacOS version in a VM.

There's been a lot of changes since v0.3.2 (NPM) and current Git, so I wouldn't be able to easily point to what change may have fixed things. Since the current code does seem to work, and I don't really have the ability right now to figure out why the old code doesn't, I might just brush this one off for now.

But if you're willing to look into it, you could try running the old code in a debugger (like GDB) and posting a backtrace / call stack when the crash occurs (or maybe you need to follow the error message and set a breakpoint at malloc_error_break) - this should show where the failure is happening.

animetosho commented 2 years ago

Also noticed that your build appears to stuck on 1 thread so I'm guessing it's the default MacOS compiler. I wonder if that has anything to do with this as I've found it to be weird in a number of ways.

Another thing is that the method is stuck on Xor-Jit - either your machine is rather old (pre-Haswell CPU) or the CPUID detection is broken.

df-a commented 2 years ago

Oh yeah, the machine is ancient, 2012. I will try to do the GDB thing for you. It just won't work properly with ngPost, it just shows up as "env: node file not found" or something similar.

I have made the symbolic link linking to ~/Applications/ParPar/bin/parpar.js, but when I run which on it it still shows up as ~/.npm/bin/parpar which I think is odd. It does work if I invoke it manually, but IO still haven't been able to get it to play nice with ngPost.

animetosho commented 2 years ago

Oh yeah, the machine is ancient, 2012

Ah that explains it then.

it just shows up as "env: node file not found"

That might happen if the node command doesn't exist and you're trying to execute the .js file. If node isn't in the PATH environment, you can manually call NodeJS with the .js file instead.

I have made the symbolic link linking to ~/Applications/ParPar/bin/parpar.js, but when I run which on it it still shows up as ~/.npm/bin/parpar which I think is odd

If you haven't uninstalled it via NPM, that version may be taking precedence.

animetosho commented 2 years ago

I installed Big Sur on a VM and gave this a try, but am unable to reproduce your issue unfortunately. I did the following from the 'clean' install (however clean an unofficial version can be):

  1. install build tools by entering cc on the command line
  2. install NodeJS 16.13.0 via installer from the NodeJS website
  3. ran npm install @animetosho/parpar - this built without issues
  4. ran the command node bin/parpar -s 1M -r 64 -o my_recovery.par2 README.md from within the ParPar install directory

As such, I can't really investigate this by myself unfortunately. If you want to help, feel free to post a GDB backtrace and re-open the issue.