You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
terminated modern session cause trouble for subsequent session #5730
a modern mode session is initiated, w. file download
"Oh no, I don't have enough bandwidth for this" -> ^C
session is terminated, leaving waste in .gmt/sessions/ causing trouble for subsequent session.
Should there not be a trap for e.g. ^C which triggers cleanup?
$ ls -l .gmt/sessions/
total 0
#make plot - I want @earth_relief_10m
$ gmt grdimage @earth_relief_10m -JM15c -RNO -pdf map
grdimage [NOTICE]: Remote data courtesy of GMT data server oceania [http://oceania.generic-mapping-tools.org]
grdimage [NOTICE]: Earth Relief at 10x10 arc minutes from Gaussian Cartesian filtering (18 km fullwidth) of SRTM15+V2.1 [Tozer et al., 2019].
grdimage [NOTICE]: -> Download grid file [3.0M]: earth_relief_10m_p.grd
^C
#^ no way I'm downloading 3.0M! ^C it is.
#use @earth_relief_05m instead, which I already have downloaded
$ gmt grdimage @earth_relief_05m -JM15c -RNO -pdf map
gmt [ERROR]: Cannot run a one-liner modern command within an existing modern mode session
#what?!
#it's the terminated session causing trouble
$ ls .gmt/sessions/
gmt_session.337778
#delete it
$ gmt clear sessions
#works
$ gmt grdimage @earth_relief_05m -JM15c -RNO -pdf map
Yes, ideally. There is some relevant history here. Florian Wobbe installed a sig_handler so that when a user hit Ctrl-C it would ask them to hit a second Ctrl-C to really quit. However, we found this interfered in some cases and ended up disabling it (see gmt.c lines 68-71). This was way before modern mode was introduced.
Now, with modern mode setting up hidden directories for sessions, should a session terminate prematurely due to a Ctrl-C then it seems desirable to remove that directory prior to exiting - this could be done by the sig_action function if we modified it and reenabled things. I see Windows is excluded so either signal is not supported there or they have their own non-posix solution. And as you know, the details tends to be very specific to a unique architecture (chip).
I have received the same message you get from time to time - usually when debugging and restarting it without letting it complete first.
The session-folder gets it's pid appended to the name, e.g. gmt_session.337778.
Why and how does a new modern mode session care/know about an earlier terminated session?
PS. I think I made a (bug) post about this issue some years(!) ago. Time flies.
Just want to add this example. It is an error (a "controlled" error) which does not remove the session. Shouldn't it?
$ gmt grdimage @earth_relief -JEPSG:4326 -RNO -pdf test
gmt [ERROR]: No projection selected
gmt [ERROR]: General map projection error
$ gmt grdimage @earth_relief -JEPSG:4326 -RNO -pdf test
gmt [ERROR]: Cannot run a one-liner modern command within an existing modern mode session
$ ls ~/.gmt/sessions
gmt_session.3287579
$ gmt grdimage @earth_relief -J"+proj=merc +ellps=WGS84 +units=m" -pdf test
gmt [ERROR]: Libcurl Error: HTTP response code said error
gmt [WARNING]: You can turn remote file download off by setting GMT_DATA_UPDATE_INTERVAL to "off"
gmt [ERROR]: Cannot request automatic remote grid resolution without -R -J settings [@earth_relief]
$ gmt grdimage @earth_relief_10m -J"+proj=merc +ellps=WGS84 +units=m" -pdf test
gmt [ERROR]: Cannot run a one-liner modern command within an existing modern mode session
$
Activity
PaulWessel commentedon Sep 7, 2021
Yes, ideally. There is some relevant history here. Florian Wobbe installed a sig_handler so that when a user hit Ctrl-C it would ask them to hit a second Ctrl-C to really quit. However, we found this interfered in some cases and ended up disabling it (see gmt.c lines 68-71). This was way before modern mode was introduced.
Now, with modern mode setting up hidden directories for sessions, should a session terminate prematurely due to a Ctrl-C then it seems desirable to remove that directory prior to exiting - this could be done by the sig_action function if we modified it and reenabled things. I see Windows is excluded so either signal is not supported there or they have their own non-posix solution. And as you know, the details tends to be very specific to a unique architecture (chip).
I have received the same message you get from time to time - usually when debugging and restarting it without letting it complete first.
anbj commentedon Sep 7, 2021
I see, thanks for explaining, Paul.
The session-folder gets it's pid appended to the name, e.g.
gmt_session.337778.Why and how does a new modern mode session care/know about an earlier terminated session?
PS. I think I made a (bug) post about this issue some years(!) ago. Time flies.
PaulWessel commentedon Sep 7, 2021
The session number is the PID of the parent, i.e., the terminal. So running another modern session in that terminal ends up with the same PID.
anbj commentedon Sep 7, 2021
Why not do modern sessions in subshells? Wouldn't this problem disappear?
PaulWessel commentedon Sep 7, 2021
Subshells would have different pid and a module cannot know that previous number.
anbj commentedon Sep 7, 2021
Right. Thanks.
Experiment with catching Ctrl-C and remove session dir
anbj commentedon Sep 16, 2021
Just want to add this example. It is an error (a "controlled" error) which does not remove the session. Shouldn't it?
anbj commentedon Sep 16, 2021
One more.
Remove session-specific directory if module is given Ctrl-C (#5739)