Skip to content

jemalloc crashes octave #216628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 tasks done
dasergatskov opened this issue Mar 26, 2025 · 2 comments
Open
4 tasks done

jemalloc crashes octave #216628

dasergatskov opened this issue Mar 26, 2025 · 2 comments

Comments

@dasergatskov
Copy link

brew gist-logs <formula> link OR brew config AND brew doctor output

% brew config
HOMEBREW_VERSION: 4.4.26
ORIGIN: https://github.com/Homebrew/brew
HEAD: f1041842141f20bc701b522d4371d7843d905580
Last commit: 2 days ago
Branch: stable
Core tap JSON: 25 Mar 19:06 UTC
Core cask tap JSON: 25 Mar 19:06 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 14
Homebrew Ruby: 3.3.7 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.7/bin/ruby
CPU: 14-core 64-bit arm_brava
Clang: 16.0.0 build 1600
Git: 2.39.5 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.3.2-arm64
CLT: 16.2.0.0.1.1733547573
Xcode: 16.2
Rosetta 2: false


% brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed kegs have no formulae!
This means they were either deleted or installed manually.
You should find replacements for the following formulae:
  lha

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libjemalloc.2.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae and may need to be deleted.

Unexpected header files:
  /usr/local/include/jemalloc/*
  /usr/local/include/octave-10.0.91/*
  /usr/local/include/rapidjson/*

Warning: Unbrewed '.pc' files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae and may need to be deleted.

Unexpected '.pc' files:
  /usr/local/lib/pkgconfig/jemalloc.pc
  /usr/local/lib/pkgconfig/octave.pc
  /usr/local/lib/pkgconfig/octinterp.pc
  /usr/local/lib/pkgconfig/octmex.pc

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae and may need to be deleted.

Unexpected static libraries:
  /usr/local/lib/libjemalloc.a
  /usr/local/lib/libjemalloc_pic.a

(Note, the jemalloc installation was done after the fact).

Verification

  • My brew doctor output says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.
  • I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.

What were you trying to do (and why)?

Compiling octave with jemalloc (from homebrew) causes an octave-svgconvert utility to crash with some minimal coredump:

(lldb) run
Process 34787 launched: '/Users/dmitri/src/octave/out_gopt/src/octave-svgconvert' (arm64)
Process 34787 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x6478)
    frame #0: 0x000000010074ec24 libjemalloc.2.dylib`je_free_default + 156
libjemalloc.2.dylib`je_free_default:
->  0x10074ec24 <+156>: ldr    x8, [x0]
    0x10074ec28 <+160>: lsr    x3, x8, #48
    0x10074ec2c <+164>: adrp   x9, 360
    0x10074ec30 <+168>: add    x9, x9, #0x3c0 ; je_sz_index2size_tab
Target 0: (octave-svgconvert) stopped.
(lldb)

Replacing the homebrew's jemalloc with a self-compiled version from git

% git rev-parse HEAD
3688dfb5c3b7d94a12e18b753c0fc9c405b77b1f

solves the problem.

What happened (include all command output)?

program crashes

What did you expect to happen?

program does not crash

Step-by-step reproduction instructions (by running brew commands)

compile octave with jemalloc (set `LIBS='-ljemalloc'`) 
For some existing SVG file (say `tx.svg`) run from the build directory

./src/octave-svgconvert "tx.svg" pdf 100 "../etc/fonts/FreeSans.otf" 0 "t1.pdf"
@Bo98
Copy link
Member

Bo98 commented Mar 27, 2025

We use the latest stable release of jemalloc: 5.3.0. If it has been fixed upstream then we'd need to find which commit did it and consider if it's safe to backport. We won't be just taking the latest unstable HEAD.

@dasergatskov
Copy link
Author

They have tested commits
jemalloc/jemalloc#2060
I am personally fine with a self-compiled version. The bug report is just FYI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants