bugGNU Octave - Bugs: bug #46845, usleep sleeps much too long on...

 
 

bug #46845: usleep sleeps much too long on macOS

Submitted by:  None
Submitted on:  Thu 07 Jan 2016 03:45:23 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Inaccurate Result
Status: Works For MeAssigned to: None
Originator Name: Daniel BetzOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 4.0.0
Operating System: Mac OS

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 Jump to the original submission)

Fri 17 Jun 2016 10:09:58 PM UTC, comment #15:

Seems like no one has been able to reproduce this other than the reporter. Still affecting the OP? Will be closed as "works for me" if no further information can identify that there is a bug in Octave.

Mike Miller <mtmiller>
Project Administrator
Fri 15 Jan 2016 10:10:44 PM UTC, comment #14:

Strange, I thought I did answer that already.... Terminal.app goes to sleep after some time (probably 30sec) but it wakes up immediately on mouse click. The Octave process never sleeps on my machine (10.11).

However, I still do not see how this is an octave bug?

Sebastian <sschoeps>
Fri 15 Jan 2016 06:17:00 PM UTC, comment #13:

@Sebastian and Carlo: do you also see that AppNap gets active after Octave is running for 30 seconds? (See comment #12)

Andreas Weber <andy1978>
Project Member
Tue 12 Jan 2016 09:38:37 AM UTC, comment #12:

step by step procedure

  • Open "Activity Monitor" ("Aktivitätsanzeige" in german) in Applications/Utilities, select tab "CPU", add column "App Nap" to table. Search for octave
  • Run "octave -f --no-gui" in a terminal

You should now see "octave-gui.. App Nap = (Nein in german, I don't know if its "false", "disabled" or "no" in english) in Activity Monitor

  • Now wait 30 seconds until "App Nap" switches to "Ja/Yes"
  • Go back to terminal to the octave> prompt and execute
  • Run it multiple times

I wonder why the "App Nap" indicator never goes back to "Nein/No". Even If I do some calculations, for example

AppNap gets activated after 30 seconds.

Anonymous
Sun 10 Jan 2016 07:33:04 AM UTC, comment #11:

I can't reproduce the issue on OSX 10.9 either:

Carlo de Falco <cdf>
Project Member
Sat 09 Jan 2016 03:53:44 PM UTC, comment #10:

My question was obviously not clear. According to my tests this timing problem is NOT present on 10.11 (darwin15.3.0) or 10.10 (darwin14.5.0). At least not with my default (!?) settings. So what do I have to do to see the problem on 10.11?

Also the new "Octave.app" does not show this behavior (neither on 10.10 nor 10.11). All built using homebrew.

Sebastian <sschoeps>
Sat 09 Jan 2016 03:32:02 PM UTC, comment #9:

@Sebastian: use

Daniel sees here much more than 100ms (sometimes 3 up to 10 seconds).

Anonymous
Sat 09 Jan 2016 02:33:47 PM UTC, comment #8:

The problem seems to be not present on Mac OS X 10.11 with octave 4.1+ (via homebrew). Can you give instructions how I can reproduce the problem on 10.11?

However, how do you start Octave on Mac OS X, e.g. via Terminal.app? I would expect that the "appnap property" is inherited in the precess tree, then you can set the
defaults write com.apple.Terminal NSAppSleepDisabled -bool true

Sebastian <sschoeps>
Sat 09 Jan 2016 02:30:21 PM UTC, comment #7:

The problem seems to be not present on Mac OS X 10.11 with octave 4.1+ (via homebrew). Can you give instructions how I can reproduce the problem on 10.11?

Sebastian <sschoeps>
Fri 08 Jan 2016 04:41:56 PM UTC, comment #6:

@Andreas: reverted to "None". "Works for me" was meant as: "There exists a Workaround" by the same user who created this bug report, thus might be of minor interest. And another user looking for this report might consider this more interesting as with "None".

Kai Torben Ohlhus <siko1056>
Project Member
Fri 08 Jan 2016 03:52:05 PM UTC, comment #5:

One can disable AppNap application-specific via e.g.

(see here: https://jamfnation.jamfsoftware.com/discussion.html?id=10566#responseChild59756)

The command "defaults" has read/write access to application-specific files called .plist ("property list"), which represent app-specific key-value data. One of these keys is called "NSAppSleepDisabled" which can be set to true for disabling App Nap.
Octave does not have such functionality (there appears nothing when searching via "defaults domains | grep octave" on a mac) which leads to my workaround: disabling AppNap globally.

Anonymous
Fri 08 Jan 2016 02:57:40 PM UTC, comment #4:

What does

Because octave has no .plist to set the boolean "NSAppSleepDisabled" to true

mean?

John W. Eaton <jwe>
Project Administrator
Fri 08 Jan 2016 12:00:21 PM UTC, comment #3:

@Kai: You are tagging this as "Works for Me", have you really tried this on Mac OSX? As Daniel already discovered this is a issue with App Nan which was intrioducted with OSX 10.9.

If enabled, "pause (0.1)" could for example run 10 seconds (seen here). This has a major impact on user experience since pause/sleep is used at some places in core.

So at least we should add Note for Mac OSX >= 10.9 users if we can't find a way to disable it.

Andreas Weber <andy1978>
Project Member
Fri 08 Jan 2016 11:32:23 AM UTC, comment #2:

The accuracy of usleep is very system depended, and on most systems you cannot sleep reliably for less 1e-3 seconds. Recently, sleep and usleep were deprecated in the development release in favor of the MATLAB compatible pause-function, which internally does nothing despite calling the POSIX compliant nanosleep:

http://hg.savannah.gnu.org/hgweb/octave/rev/58263bea2fdf

Thus replace usleep(100) by pause(1e-4).

If there is nothing more about this issue, I can close it.

Kai Torben Ohlhus <siko1056>
Project Member
Fri 08 Jan 2016 08:01:55 AM UTC, comment #1:

As I heard from a colleague, disabling AppNap should help. Because octave has no .plist to set the boolean "NSAppSleepDisabled" to true, I disabled it globally via

Executing the same commands results in the following times (which are way more accurate!):

Anonymous
Thu 07 Jan 2016 03:45:23 PM UTC, original submission:

Installed using brew from https://github.com/Homebrew/homebrew-science/blob/master/octave.rb

as you can see the time sleeped is much longer than requested.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by cdf (Posted a comment)
  • -unavailable- added by sschoeps (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by andy1978 (Posted a comment)
  • -unavailable- added by siko1056 (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 23 Nov 2016 11:36:16 PM UTCmtmillerOpen/ClosedOpen=>Closed
    Fri 17 Jun 2016 10:09:58 PM UTCmtmillerStatusNone=>Works For Me
      Summaryusleep sleeps much too long on Mac OSX=>usleep sleeps much too long on macOS
    Fri 08 Jan 2016 04:41:56 PM UTCsiko1056StatusWorks For Me=>None
      Assigned tosiko1056=>None
    Fri 08 Jan 2016 11:32:23 AM UTCsiko1056StatusNone=>Works For Me
      Assigned toNone=>siko1056

    Back to the top


    Powered by Savane 3.1-cleanup1