bugGNU Octave - Bugs: bug #52061, Memory issue whenever Java JVM is...


bug #52061: Memory issue whenever Java JVM is used

Submitted by:  Rik <rik5>
Submitted on:  Tue 19 Sep 2017 06:36:00 PM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Invalid Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Mon 09 Oct 2017 12:38:56 AM UTC, comment #19:

I resurected some old (Core 2 duo) laptop and it also does NOT
crash. So it looks like the newish CPUs are causing the problem.

On i7 I compiled a minimal version
so I do not need top bother with LD_PRELOAD=libasan.so
(which seems to be changing things a little).
Then running under gdb I get:

vm_version_x86.cpp:530 is:


The file is attached.


(file #42098)

Dmitri A. Sergatskov <dasergatskov>
Sun 08 Oct 2017 05:12:58 PM UTC, comment #18:

Since this issue comes up again for macOSX, I must add that
I have a computer where it does not crash (XEon + Nvidia) but it
still crashes on AMD CPU/AMD GPU and i7/AMD systems.

All computers run approximately the same software otherwise
(Fedora 26 or 27-beta now).

So may be we should re-open it.


Dmitri A. Sergatskov <dasergatskov>
Thu 21 Sep 2017 12:53:35 AM UTC, comment #17:

I don't want to have alloc-dealloc mismatches, but you're right that most of this looks like it is happening in external libraries and/or would be very hard to debug. I think we can leave it alone for now and concentrate on more immediate problems.

Rik <rik5>
Project Administrator
Wed 20 Sep 2017 08:54:10 PM UTC, comment #16:

Here is another one:

So i cannot start gdb. it is all looks false positive to me so far. But I will keep an eye on it.


Dmitri A. Sergatskov <dasergatskov>
Wed 20 Sep 2017 08:47:26 PM UTC, comment #15:

Most of those seems to come from external libraries (e.g. Qt).
Here is a simplest example:

Note print() is important. Just plot and exit does not trigger it.


Dmitri A. Sergatskov <dasergatskov>
Wed 20 Sep 2017 08:34:51 PM UTC, comment #14:

Okay, I'll close this bug. Maybe you want to open up another bug report for the alloc-dealloc-mismatch errors?

Rik <rik5>
Project Administrator
Wed 20 Sep 2017 06:26:37 PM UTC, comment #13:

I get few alloc-dealloc-mismatch errors, so I did:

It passes

Also did some plots etc...


Dmitri A. Sergatskov <dasergatskov>
Wed 20 Sep 2017 04:36:57 PM UTC, comment #12:

That is good news. I don't run a bleeding edge system so I can't test this, but am willing to close the bug if it is really a problem with the Address Sanitizer.

Do you find any other issues with the JVM? Other more ordinary memory leaks, etc.? For example, does this show any problems

compared to the base leak log for

Rik <rik5>
Project Administrator
Wed 20 Sep 2017 04:31:11 PM UTC, comment #11:

As of "a1801e80bb11" I do not see java crashes any more.
There were also a minor gcc update
(7.2.1-1 to 7.2.1-2 see:
for the changelog that includes some fixes for sanitizer
sanitizer/63361, sanitizer/81923)


Dmitri A. Sergatskov <dasergatskov>
Wed 20 Sep 2017 10:37:42 AM UTC, comment #10:


Did you build it with libasan?
(configure --enable-address-sanitizer-flags)


Dmitri A. Sergatskov <dasergatskov>
Wed 20 Sep 2017 06:32:44 AM UTC, comment #9:

Again FWIW, the same Octave, yet cross-built for w64, runs fine on Windows 10 as well w. Oracle Java).

Philip Nienhuis <philipnienhuis>
Project Member
Wed 20 Sep 2017 06:27:46 AM UTC, comment #8:

FWIW, I can't reproduce the segfault on Mageia Linux 64b with Octave-4.3.0+ (hg id 8a6747c6db1a, from Sep 17)

(Java = java-1.8.0-openjdk, v. rel. 1.b16.1.mga6)

Looks like the segfault is related to the specific Java implementation on your boxes.

Philip Nienhuis <philipnienhuis>
Project Member
Wed 20 Sep 2017 05:28:14 AM UTC, comment #7:

Using gdb to trace through the code, the actual line that causes the segfault is line 210 in liboctave/util/oct-shlib.cc.

At that point, the file variable is

The flags variable is 258.

It certainly seems like this is just something wrong with libjvm.so. I tried changing the flags to the minimum, RTLD_LAZY, but it didn't help.

Rik <rik5>
Project Administrator
Wed 20 Sep 2017 04:55:36 AM UTC, comment #6:

And doing the same with java-9:


Dmitri A. Sergatskov <dasergatskov>
Wed 20 Sep 2017 04:26:31 AM UTC, comment #5:

I get:


Dmitri A. Sergatskov <dasergatskov>
Tue 19 Sep 2017 07:19:36 PM UTC, comment #4:

Just creating the JVM is enough to cause the issue. The internal Octave function

by itself will cause the segfault.

Rik <rik5>
Project Administrator
Tue 19 Sep 2017 07:13:10 PM UTC, comment #3:

I installed openjdk-8-dbg, but it didn't seem to make a difference. The backtrace was still short and opaque, although now it references Python for some reason.

Rik <rik5>
Project Administrator
Tue 19 Sep 2017 06:43:53 PM UTC, comment #2:

Do you have debug symbols for java installed? On Fedora it is a separate package...


Dmitri A. Sergatskov <dasergatskov>
Tue 19 Sep 2017 06:40:50 PM UTC, comment #1:

Running under gdb isn't any more helpful. The backtrace is

Rik <rik5>
Project Administrator
Tue 19 Sep 2017 06:36:00 PM UTC, original submission:

The Address Sanitizer detects a segmentation violation whenever the Java interface from Octave is used. Sample code:

The resulting backtrace is very sparse on information, even with "verbose=1" in ASAN_OPTIONS.

Perhaps a debug version of the JNI interface can be compiled in to get more information.

Rik <rik5>
Project Administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #42098:  vm_version_x86.cpp added by dasergatskov (47KiB - text/x-c++src)


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-10-09 dasergatskov Attached File- => Added vm_version_x86.cpp, #42098
    2017-09-20 rik5 StatusConfirmed => Invalid
        Open/ClosedOpen => Closed
    2017-09-20 rik5 StatusNone => Confirmed
    2017-09-19 rik5 Dependencies- => bugs #52062 is dependent

    Back to the top

    Powered by Savane 3.4