FS#70640 - sagemath gap interface broken if gap-packages installed

Attached to Project: Community Packages
Opened by Austin (vujazzman) - Thursday, 29 April 2021, 18:58 GMT
Last edited by Antonio Rojas (arojas) - Saturday, 01 May 2021, 18:26 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Antonio Rojas (arojas)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
If sagemath, its dependency gap, and gap's optional package gap-packages are installed, gap inside sagemath does not work.

Additional info:
* package version(s)
sagemath 9.2-18
gap 4.11.1-1
gap-packages 4.11.1-1

Those versions and also many prior versions; I just haven't bothered reporting this bug until now.

* config and/or log files etc.
Problem exists even after deleting configuration files

Steps to reproduce:
Install sagemath and gap-packages

$ sage
sage: gap('2+2')


this will eventually issue an error, ending with something like

TypeError: unable to start gap: End Of File (EOF). Exception style platform.
Gap with PID 2709581 running /usr/bin/gap -r -L /home/austin/.sage/gap/gap-workspace-5c0e77c46be77719bc1c0a5ec9c64b94d2a2e50c -b -p -T -E -o 401m -s 401m -m 64m /usr/lib/python3.9/site-packages/sage/ext_data/gap/sage.g
command: /usr/bin/gap
args: ['/usr/bin/gap', '-r', '-L', '/home/austin/.sage/gap/gap-workspace-5c0e77c46be77719bc1c0a5ec9c64b94d2a2e50c', '-b', '-p', '-T', '-E', '-o', '401m', '-s', '401m', '-m', '64m', '/usr/lib/python3.9/site-packages/sage/ext_data/gap/sage.g']
buffer (last 100 chars): b''
before (last 100 chars): b'[?1l\x1b>@fError, @freached the pre-set memory limit@J@f(change it with the -o command line option)@f@J'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 2709581
child_fd: 16
closed: False
timeout: None
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 4194304
ignorecase: False
searchwindowsize: None
delaybeforesend: None
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
This task depends upon

Closed by  Antonio Rojas (arojas)
Saturday, 01 May 2021, 18:26 GMT
Reason for closing:  Upstream
Comment by Antonio Rojas (arojas) - Thursday, 29 April 2021, 19:53 GMT
Sage allocates memory for the GAP workspace using some heuristics based on your system's available RAM https://git.sagemath.org/sage.git/tree/src/sage/interfaces/gap.py#n270

This error means it's not allocating enough memory to load all packages on your system. You'll need at least 1GB, you can bypass sage's allocation by using something like this in your init.sage:

from sage.interfaces.gap import set_gap_memory_pool_size
set_gap_memory_pool_size(2^30)

Please report it upstream if you think sage's algorithm should be improved.
Comment by Austin (vujazzman) - Friday, 30 April 2021, 02:38 GMT
Thank you for the discussion. I tried what you said, both in an interactive session and in .sage/init.sage, but I am still seeing the same problem, and it looks like setting that didn't change the way gap is called by sage (it still has -o 401m, for example).

Do you know if there are other ways to affect the settings with which sage calls gap?

In any case I agree this doesn't look like an arch problem.
Comment by Antonio Rojas (arojas) - Friday, 30 April 2021, 05:47 GMT
did you delete ~/.sage/gap? Otherwise it will reuse the previous cached GAP workspace
Comment by Austin (vujazzman) - Friday, 30 April 2021, 21:59 GMT
Deleting ~/.sage/gap did not work, but including

gap = Gap()

~/.sage/init.sage after the change to gap memory pool size did work.

For what its worth I do find sage's default memory allocation for gap too small, but it's hard to say if it should be considered a bug upstream; perhaps it needs some guidance in the error message on how to increase the default allocation. As for specifically breaking with gap-packages, perhaps this shouldn't be considered upstream's fault as the install for self contained sage doesn't include gap-packages.

Thank you for your help! At least I wont have this problem anymore.
Comment by Antonio Rojas (arojas) - Saturday, 01 May 2021, 18:26 GMT
I filed a ticket upstream to stop loading every single installed GAP package, which is the ultimate cause of this https://trac.sagemath.org/ticket/31761

Loading...