bugGNU Octave - Bugs: bug #59310, Calling java from octave:...

 
 

bug #59310: Calling java from octave: Unreasonable resource exhaustion

Submitted by:  None
Submitted on:  Tue 20 Oct 2020 07:07:04 AM UTC
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Duplicate Assigned to:  None
Originator Name:  T Herzke Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 5.2.0
Operating System:  * GNU/Linux
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

( Jump to the original submission )

Tue 13 Jul 2021 10:10:45 AM UTC, comment #6: 

This fixes it! Thank you!

To summarize: In order to use javaruntime.exec from within Octave (default Octave package) on Ubuntu 20.04, make sure that a file named /usr/share/octave/5.2.0/m/java/java.opts exists and contains the line

-Djdk.lang.processReaperUseDefaultStackSize=true

Anonymous
Sat 10 Jul 2021 07:35:25 AM UTC, comment #5: 

It might have been bug #58641 that added a work around for a possible bug with glibc that can cause issues that are similar to what you are describing.

If it is, it might be possible to have affected users run this command in Octave once:

system('echo -Djdk.lang.processReaperUseDefaultStackSize=true >> $OCTAVE_JAVA_DIR/java.opts')

I'm not sure what $OCTAVE_JAVA_DIR is on Ubuntu 20.04. So the users might need root access to change that file.

They might need to restart Octave after that switch was added to the default JVM command line options.

Markus M├╝tzel <mmuetzel>
Project Member
Fri 09 Jul 2021 05:29:20 PM UTC, comment #4: 

Thank you dear Octave developers for fixing this Octave bug somewhere between Octave-5.2.0 and Octave-6.0.90:

While using the same openjdk 11.0.11 with both versions, this bug manifests with Octave-5.2.0 but not anymore with Octave-6.0.90.

Would you please point me to what you have changed to fix this bug so that maybe we can provide an updated 5.2.0 with a bugfix for our users that might still use ubuntu 20.04 and therefore Octave-5.2.0 for the next 4 years?

Thank you very much, T Herzke

(By the way, the suggested java.opts settings have had no effect).

Anonymous
Tue 03 Nov 2020 05:37:23 PM UTC, comment #3: 

No response.  Closing report.

Rik <rik5>
Project Administrator
Mon 26 Oct 2020 08:21:09 AM UTC, comment #2: 

maybe use a java.opts file to control initial heap allocation?
See also bug #53943

My java.opts has this:

-Xms64m
-Xmx128m

A.R. Burgers <arb>
Wed 21 Oct 2020 09:18:12 PM UTC, comment #1: 

This feels to me like the issue is less with Octave and more with changes to the JVM and operating system.  It's possible that Ubuntu changed the maximum number of threads a process could have by default,  You might take a look at the 'ulimit' shell command.  This link might also be helpful since it is about Java failures: https://github.com/elastic/elasticsearch/issues/31982.

Rik <rik5>
Project Administrator
Tue 20 Oct 2020 07:07:04 AM UTC, original submission:  

This was working fine in octave 4.2.2 with openjdk 11 (default versions on ubuntu 18.04).

It fails with octave 5.2.0 with openjdk 11 (default versions on ubuntu 20.04). It also fails when replacing openjdk 11 with openjdk 8.

All tests were performed with standard ubuntu packages for octave and default-jre-headless on the respective releases 18.04 and 20.04.

Steps to reproduce with a simpe example:

  • In ubuntu 20.04, install octave and java:

apt install octave default-jre-headless

  • Start octave, enter these three commands:

javaruntime = javaMethod('getRuntime','java.lang.Runtime');
command = 'touch /tmp/testfile1';
process = javaruntime.exec(command)

Expected results:
1. A file /tmp/testfile1 should have been created.
2. Variable "process" should now reference a java object of type java.lang.ProcessImpl.
3. No error occurs.

Actual results:
1. A file /tmp/testfile1 has actually been created as expected. The child process has successfully executed.
2. Variable "process" does not exist because javaruntime.exec() was terminated with an error.
3. First a warning occurs, then an error occurs. Warning and error messages:

[0.063s][warning][os,thread] Failed to start thread - pthread_create failed (EINVAL) for attributes: stacksize: 136k, guardsize: 0k, detached.
error: [java] java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached

I have tried this on multiple systems running ubuntu focal, including fresh installations, therefore this is not caused by some system with quirky thread creation limits.

When running this example in octave with strace

strace -f --trace=clone octave --eval example

(where example.m contains the three lines from above),
I can see that the child process is created successfully and exits with exit code 0 before the warning about thread creation is printed.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by arb (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.

     

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-07-10 mmuetzel StatusNeed Info => Duplicate
        Dependencies- => Depends on bugs #58641
    2020-11-03 rik5 StatusNone => Need Info
        Open/ClosedOpen => Closed

    Back to the top


    Powered by Savane 3.9