-
Notifications
You must be signed in to change notification settings - Fork 7
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
Garbage-collection problem #238
Comments
BTW: This is a problem because it makes it impossible to differentiate errors from non-errors. |
Hi, did you try "sys.exit(0)" ? |
I did now. Same result as for exit(0) directly. In fact, I believe that with "import sys" exit() really is sys.exit().
Note that while exit() and sys.exit() in general allows a graceful termination of the program by
os._exit() does none of those things - it just makes an immediate termination, and could leave info (eg buffers) hanging. |
We will check it! Thanks! |
Hello again @buchmann-dhi , I've tried to reproduce the error in one of our Windows OS VMs, but I wasn't able to get the same result. In my case, I tried both the pre-release (2.0.0.a4) and the latest v1.3.5, both worked as expected. I'm using Python 3.12.8 in a Windows 11. Could you specify also these information (python version and windows OS) so I can try to reproduce the error? This would be the updated code to be able to run it on v2.0.0.a4 (and when we release too): import copernicusmarine
from datetime import datetime
ofil= copernicusmarine.subset(
# Subset args:
minimum_longitude=-13,
maximum_longitude=5.0,
minimum_latitude=47.0,
maximum_latitude=64.0,
start_datetime=datetime.strptime('2024120100', '%Y%m%d%H'),
end_datetime=datetime.strptime('2024120300', '%Y%m%d%H'),
minimum_depth=0.49,
maximum_depth=5727.92,
# Dataset args:
dataset_id='cmems_mod_glo_phy_anfc_0.083deg_P1D-m',
variables=['zos'],
output_filename='zos.nc',
overwrite = True,
# Forcing and other args:
disable_progress_bar = True,
)
print("Download completed")
exit(0) |
Hi @uriii3 The present system here is Windows 11, and as I stated tested on 1.3.4. Python version is 3.11.7, but really that aught not to matter. This particular virtual environment has only installed whatever packages was necessary to install copernicus (in addition to a few select base packages). Pip freeze output will be submitted: C:\Users\BJB>C:\PYVENV\cmems134\Scripts\python.exe -m pip freeze I have seen the same problematic exit code on the CLI-version on several installations - spanning several versions of the Copernicus marine 1.x - varying across different VM installations. It does seem to be inconsistent in that it may give a zero exit code on some installations and non-zero on others. I had hoped that I found why or at least a consistent/reproducible error case, but apparently not so. Please note that our use case is operational forecasting, so we will not be installing anything even remotely close to bleeding edge. Stability is king. Thus, we will not move to your v2 for the first few months after its release. In fact, I am presently considering downgrading to a version that does not write obsoletion-messages to STDERR, as it is messing with our production. |
Hi @uriii3 Just an update. Made a clean-install of 1.3.5 directly from native py 3.11.7 venv. Same result. It is still quite possible that there are system-depending stuff going on, so I cannot say for sure that this is reproducible. But it is as "clean" as can be made on my dev PC. Log below (with some output skipped):
I dont know exactly what goes on, but copernicusmarine has a hefty dependency track, which also means that I/we will not reuse copernicus marine venvs for other jobs/scripts. |
Hello @buchmann-dhi , We were able to reproduce the error with v1 but it looks like in v2 it is not reproducible, so it looks like it is fixed on v2. We suspect a problem with the We understand about the operational uses and you can move to v2 when you find adequate. However, could you tell us if you can reproduce this error with the prerelease 2.0.0a4? |
Dear @uriii3 / Oriol, I have now tested with a "clean" version of 2.0.0a4, and I did not get the same error on exit status (for this particular setup).
OK. But since the bug has not actually been tracked down, it could perceivably be a coincidence that I/we do not see the problem in this particular case.
While I understand your priorities, this is a problem that I have tried to escalate for quite some time (through the mail support). I should like it resolved at least in a way, so that we (you, me, both) are confident that it does not persist into v2.0.x. I reported this issue as far back as v1.0.0 (2024-02-20) with the CLI-version, and then we (me, this end) have been plagued with it on and off through the various versions inconsistently across machines.
Roger that. If you leave v1 burning (no fix), then it could potentially increase my willingness to switch quickly (although not my happiness with the service as a whole). For operational forecasting/downstream services, I should really like a stable version of v1 before we make a controlled switch - with breaking changes - to a stable version 2.x. I hope this makes sense from a user-land perspective at least. Best, |
Hi @buchmann-dhi, As far as we could reproduce the bug, it seems to be that it comes from Let's see if we want to solve this problem for the v1. This decision will probably be taken after the release of the v2.0.0. I, personally, am not able to reproduce this problem (not using windows and our windows VM does not have this problem). Have great winter holidays :D |
There seems to be some kind of problem with the garbage collection / SystemExit of copernicusmarine toolbox.
I have tested with different versions - including 1.3.4 - and I have now a minimal program to show the issue.
The effect is that when I call "exit(0)" after retrieving a subset (see attached py script), then windows OS reports exit code -1073741819 (translates to uint 0xC0000005).
If I change "exit(0)" to "os._exit(0)" then all is well, except that it bypasses any and all garbage collection (done in copernicusmarine).
Note that I have seen this funky exit code when running the CLI tool, and I have already reported it to the operators.
EXAMPLE CODE:
Here is the output from a windows CMD using a copernicusmarine v 1.3.4 virtual environment:
The text was updated successfully, but these errors were encountered: