Opened 3 years ago

Closed 3 years ago

#61536 closed defect (fixed)

asymptote @2.65 build on Big Sur causes kernel panic, does not work on El Capitan or Catalina either

Reported by: snowflake (Dave Evans) Owned by: mojca (Mojca Miklavec)
Priority: Normal Milestone:
Component: ports Version: 2.6.99
Keywords: Cc:
Port: asymptote

Description

When building asymptote I get a kernel panic. I have tried this 4 times and each time 5 minutes into the build the kernel panics. I have submitted reports to Apple for each instance.

My Macports:

  "os": {
    "macports_version": "2.6.99",
    "osx_version": "11.0",
    "os_arch": "i386",
    "os_platform": "darwin",
    "build_arch": "x86_64",
    "cxx_stdlib": "libc++",
    "gcc_version": "none",
    "xcode_version": "12.2",
    "clt_version": "none"
  },

I have the command line tools version 12.2 installed but mpstats does not seem to know.

Software version from sw_vers:

ProductName:	macOS
ProductVersion:	11.0.1
BuildVersion:	20B29

Attachments (1)

snowflake.asy.sh (637 bytes) - added by snowflake (Dave Evans) 3 years ago.
Script to patch and configure asymptote from git checkout

Download all attachments as: .zip

Change History (19)

comment:1 Changed 3 years ago by snowflake (Dave Evans)

Today, I installed macOS 11.1 beta and command line tools 12.2, both suggested by Software Update.

ProductName:	macOS
ProductVersion:	11.1
BuildVersion:	20C5048k

Building asymptote again, I get this message pop up: Your system has run out of application memory together with a list of Apps to force quit. None of them were using much memory. After a minute the system rebooted.

I suppose that is a bit more informative than simply panicing.

comment:2 Changed 3 years ago by snowflake (Dave Evans)

Asymptote process asy has a severe memory leak - tens of GB.

In /Library/Logs/DiagnosticReports I found a file Kernel-2020-11-18-100514.panic . It is in JSON with a large chunk of modified Base64. I extracted the Base64, deleted the \ characters and decoded it. It turned out to be a long list of the processes running at the time of the panic. There were 4 instances of asy and each was taking more then 10GB of memory footprint. Using locate, I found that asy was in the work folder for the asymptote build.

I initially surmised that the panic was due to an obscure bug in the compiler, but I am probably wrong. It's either a bug in asymptote or the compiler is producing duff code.

comment:3 Changed 3 years ago by mojca (Mojca Miklavec)

Would you be willing to report the problem to https://github.com/vectorgraphics/asymptote?

I'm unable to help you myself.

comment:4 Changed 3 years ago by mojca (Mojca Miklavec)

Also, just in case, would you perhaps be willing to test whether asy from the TeX Live repository works? You could install MacTeX or BasicTeX, or simply run the command-line installer from https://www.tug.org/texlive/quickinstall.html installing just the barebone scheme + asymptote. You can install it to any given folder in user space and just delete it afterwards.

Or maybe try downloading the precompiled binary from http://tug.org/svn/texlive/trunk/Master/bin/x86_64-darwin/ to see if that one crashes as well.

comment:5 Changed 3 years ago by snowflake (Dave Evans)

I have been building asy in the work directory after configuring it with port and changing all the files to be owned by me.

Running make in the root directory works and the asy command is built. I then cd into the doc directory and do make clean; make doc

I get this log:

Script started on Wed Nov 18 21:14:12 2020
command: make doc
../asy -dir ../base -config "" -render=0 -h 2>&1 | grep -iv Asymptote > options
../asy -dir ../base -config "" -render=0 -f pdf -noprc Bode.asy
../asy -dir ../base -config "" -render=0 -f pdf -noprc CAD1.asy
../asy -dir ../base -config "" -render=0 -f pdf -noprc CDlabel.asy
../asy -dir ../base -config "" -render=0 -f pdf -noprc GaussianSurface.asy
GPL Ghostscript 9.53.3: 
   *** EPS files may not contain multiple pages.
   *** Use of the %d filename format is required to output pages to multiple EPS files.
GPL Ghostscript 9.53.3: Unrecoverable error, exit code 1
^Cmake: *** [GaussianSurface.pdf] Interrupt: 2

Script done on Wed Nov 18 21:14:40 2020

Watching the memory usage with top, I see asy steadily increasing its memory usage at about 1 GB per second. When it gets to about 25 GB I terminate the process with ctrl-C.

comment:6 Changed 3 years ago by snowflake (Dave Evans)

I will report the bug upstream.

comment:7 Changed 3 years ago by snowflake (Dave Evans)

I tried the binary from tug.org. It shows the exact same problem - rapidly increasing memory usage,

comment:8 Changed 3 years ago by snowflake (Dave Evans)

Summary: asymptote @2.65 build on Big Sur causes kernel panic.asymptote @2.65 build on Big Sur causes kernel panic, does not work on El Capitan or Catalina either

comment:9 Changed 3 years ago by snowflake (Dave Evans)

I tried the method listed in comment 5, and got the same bug on Catalina and El Capitan. On Catalina the memory usage reached 56 GB before i stopped it. On El Capitan memory reached 500MB before the system slowed to a crawl.

https://trac.macports.org/ticket/61536#comment:5

I haven't used asymptote for a while, so this is why I've never noticed it before.

Changed 3 years ago by snowflake (Dave Evans)

Attachment: snowflake.asy.sh added

Script to patch and configure asymptote from git checkout

comment:10 Changed 3 years ago by snowflake (Dave Evans)

The bug seems to have been fixed upstream, at least for El Capitan.

I checkout out asymptote from git. I used my snowflake.asy.sh script (see Attachments) to patch and configure the checkout.

On El Capitan, I was able to build asy for both the latest source and version 2.65. The build from the latest source did not show the bug documented previously. The 2.65 version did indeed use excessive memory.

On Big Sur and Catalina, I was not able to build asy due to compilation errors.

comment:11 Changed 3 years ago by mojca (Mojca Miklavec)

What about version 2.67? Is the bug still present there? If not, it makes sense to immediately update asy (sorry, I didn't see the update). If the bug is still there, I would ask the developer to tag another release as soon as possible.

Can you please copy-paste some build failures from Big Sur and/or Catalina (maybe directly under https://github.com/vectorgraphics/asymptote/issues)?

comment:12 Changed 3 years ago by snowflake (Dave Evans)

2.67 is broken on El Capitan. I've not tried the other two yet.

comment:13 Changed 3 years ago by snowflake (Dave Evans)

I've been doing some builds on Catalina using a Portfile with null code for fetch, checksum, and extract. This is so I can build with a script which copies the checkout to the Macports work areas.

It appears that the source went from broken to working to broken again in the space of 4 hours.

Here are the results:

--------------------------------------------
commit 42b291049920c2a023ab5f3598cc917eb36297ca (HEAD)
Merge: e62d0401 d9826965
Author: John Bowman <bowman@ualberta.ca>
Date:   Sun Oct 25 20:18:21 2020 -0600

*** Severe Memory Leak (many GB) ***
--------------------------------------------
commit 3361214340d58235f4dbb8f24017d0cd5d94da72 (HEAD)
Author: John Bowman <bowman@ualberta.ca>
Date:   Sun Oct 25 22:24:51 2020 -0600

*** builds and works without memory leak ***

Use ps2write instead of eps2write where possible,
    for compatibility with gs 9.53.
--------------------------------------------
commit e688d42e33a521facdb050c77b454b819478d3fd (HEAD)
Author: John Bowman <bowman@ualberta.ca>
Date:   Sun Oct 25 23:08:36 2020 -0600
    
*** BUILD ERRORS ***
In file included from util.cc:33:
./locate.h:21:61: error: default argument references parameter 'suffix'
string locateFile(string id, bool full=false, string suffix=suffix);
There are many of these errors.
--------------------------------------------

I'm not convinced that switching from eps2write to ps2write has fixed the memory leak. It is still in the background waiting to pounce.

comment:14 Changed 3 years ago by snowflake (Dave Evans)

Bugs or at least a pointer to this Macports page now reported upstream here:

https://github.com/vectorgraphics/asymptote/issues/190

comment:15 Changed 3 years ago by snowflake (Dave Evans)

John Bowman (Asymptote developer) has committed two fixes. I've tested them on Catalina and El Capitan and they both work fine now with no memory leaks. Thanks, John.

comment:16 Changed 3 years ago by snowflake (Dave Evans)

Works on Big Sur as well

comment:17 Changed 3 years ago by mojca (Mojca Miklavec)

Ok, so my suggestion would be to upgrade to 2.68 then. John promised a new release ASAP.

comment:18 Changed 3 years ago by mojca (Mojca Miklavec)

Resolution: fixed
Status: assignedclosed

In 647bf561d5c25c1a4fb216cfa29239bcf2624a16/macports-ports (master):

asymptote: update to 2.68

Closes: #58849
Closes: #61536

Note: See TracTickets for help on using tickets.