New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
py3: polynomial_rational_flint.pyx problem #28334
Comments
comment:1
I installed a Debian virtual machine, and now I can see this error. This problem does not seem related to the particular doctest: if I remove lots of other doctests from that file but keep this one, the error goes away. If I instead keep the file intact and add some print statements, the error is printed as this line is executed:
Any ideas how to debug this? |
comment:2
It could be related to the problem discussed at #28106. |
comment:3
Replying to @jhpalmieri:
On the other hand, I've tried increasing the default |
comment:4
Also, I get the same error in a Sage session with
I don't think this uses |
comment:5
I added a few print statements to flint's |
comment:6
I don't have a debian machine and know nothing about flint. But John's experiment seems to indicate that the memory error is genuine. I guess somehow the polynomial_rational_flint module of sage on debian machine leaks memory. |
comment:8
I'm seeing this on an Ubuntu virtual machine (running on the same OS X box). I wonder if it's the processor as much as which type of linux is running. This machine has a Core i7 processor. |
comment:9
Replying to @jhpalmieri:
As reported in https://groups.google.com/d/msg/sage-release/VuAt1Sc46IQ/n9ejPwoiAwAJ, I also get the error on a Xeon E5-2623 processor (with Ubuntu 18.04). |
comment:10
According to the entry (G) in the summary table of #28298, the doctest discussed here is passed on the reference patchbot, which is a Ubuntu machine though... |
comment:11
Replying to @egourgoulhon:
Well, actually it is reported as failed in Is this the "reference patchbot" for Python 3 Sage? If yes, then the table of #28298 must be updated. |
comment:12
Okay, I think I know what's going on. This is the same problem as in #28454: strings are being sent to stdout by a C or C++ library but the output is not flushed, or whether it's flushed is system/OS-dependent, so messages like "Exception (FLINT memory_manager). Unable to allocate memory." do not get printed when we expect them, but rather some time later. In this particular case, the message should be printed when this doctest is run:
in which case it's captured by the "...". But on some platforms, with Python 3 only, the message is not printed at the right time. (I don't know why, but this really does seem to be what's going on.) One solution would be to modify FLINT to flush the output. Is there a pure Python 3 solution, which we can incorporate in the Sage library without patching or modifying FLINT? |
comment:13
Replying to @jhpalmieri:
I should also note that patching FLINT won't help if a user is using the system's version of FLINT. So can we do this just with Sage's FLINT interface? |
Branch: u/jhpalmieri/flint-flush |
Commit: |
comment:15
Having said that, here is a patch for FLINT. This fixes the problem for me. I won't mark as "needs review" yet, since I would like to know if there is a fix for this on the !Sage/Python side first. If that looks possible but complicated, we can use this patch as a stopgap. New commits:
|
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:18
A stupid workaround, by the way, would be to label the doctest in comment:12 as |
comment:19
I see this failure, as well as that at #28454, on a sage-on-gentoo build using py3. Of course both |
comment:20
John Cremona is working on a new |
comment:21
I think these are the options:
The last one should be the best, but I don't know how to do it. Do we do either of the others as a stopgap, or wait? |
Changed keywords from none to flint, flush |
comment:22
cc-ing Bill Hart who might have some insight on this. |
comment:24
There has been no progress on this. I'm going to mark this as "needs review", since the other options (new flint, or get Sage to flush flint's output) can coexist with this. As I've said before, I would welcome other solutions. |
Author: John Palmieri |
comment:25
Would it help to file an issue or a pull request at https://github.com/wbhart/flint2. There are numerous locations in the
Then again adding a |
comment:26
I created a pull request, but since the last release was four years ago, I don't have high hopes. |
Upstream: Reported upstream. No feedback yet. |
comment:27
Replying to @jhpalmieri:
The FLINT repo is active, and has |
Changed upstream from Reported upstream. No feedback yet. to Fixed upstream, but not in a stable release. |
comment:28
The pull request has been merged. |
comment:29
This is the main remaining Py3 doctest failure. Shall we merge this, and then later hope to find a systematic way to flush output, or upgrade flint when it's ready? |
comment:31
I think we should merge it, but I'll wait for comment. |
comment:32
+1 to merging this. If you end up inserting "flush" in the interface wrappers, you'll end up flushing a lot when there's nothing to flush. Since flush is a system call, such wasteful use of resources might end up quite noticeable. Better flush at the source, where you know when it's necessary. |
comment:33
I'll push the button. It can always be undone. |
Reviewer: Steven Trogdon |
Changed branch from u/jhpalmieri/flint-flush to |
On some systems, Debian for example, we see this failure with Python 3:
Upstream: Fixed upstream, but not in a stable release.
CC: @slel @sagetrac-spancratz @wbhart @fchapoton
Component: python3
Keywords: flint, flush
Author: John Palmieri
Branch/Commit:
ed66988
Reviewer: Steven Trogdon
Issue created by migration from https://trac.sagemath.org/ticket/28334
The text was updated successfully, but these errors were encountered: