Skip to content

File lock on Windows #3765

Closed

Description

@seisman

A new failure on Windows:

 9/11 Test #815: psxy/urlquakes.sh ................***Failed    4.14 sec
Set GMT_SESSION_NAME = 40326
psxy [ERROR]: Failed to create lock file C:\Users\VSSADM~1\AppData\Local\Temp/query.csv?starttime=2016-01-01%2000:00:00&endtime=2016-02-01%2000:00:00&minmagnitude=4.5&orderby=magnitude.download
psxy [ERROR]: Unable to obtain remote file https://earthquake.usgs.gov/fdsnws/event/1/query.csv?starttime=2016-01-01%2000:00:00&endtime=2016-02-01%2000:00:00&minmagnitude=4.5&orderby=magnitude
ERROR: gmtest:58
memtrack errors: 0
exit status: 1

Activity

  1. PaulWessel commented on Jul 29, 2020

    @PaulWessel
    Contributor

    Fair enough. I need to disable locking on URLs queries.

  2. seisman commented on Jul 29, 2020

    @seisman
    MemberAuthor

    Closed by #3768.

  3. seisman commented on Jul 30, 2020

    @seisman
    MemberAuthor

    Re-open the issue because I still see the same error in the recent cron CI job.

  4. added a commit that references this issue on Jul 30, 2020
    d302498
  5. added a commit that references this issue on Jul 30, 2020
    5652beb
  6. joa-quim commented on Jul 30, 2020

    @joa-quim
    Member

    Still fails for me

    psxy [ERROR]: Failed to create lock file C:\TMP/query.csv?starttime=2016-01-01%2000:00:00&endtime=2016-02-01%2000:00:00&minmagnitude=4.5&orderby=magnitude.download
    

    But there are no file locks on Windows, at least like the unix ones, right?

  7. PaulWessel commented on Jul 30, 2020

    @PaulWessel
    Contributor

    Could you find out why my check for the url query fails? Perhaps that macro has a problem.

  8. joa-quim commented on Jul 31, 2020

    @joa-quim
    Member

    The problem is not the macro. The error message is not coming from gmtremote_get_url() but from gmt_download_file()

  9. joa-quim commented on Jul 31, 2020

    @joa-quim
    Member

    Maybe the problem is this. Windows doesn't accept ? in file names (that file was manually created by me).

    image

  10. PaulWessel commented on Jul 31, 2020

    @PaulWessel
    Contributor

    That is fine, it is allowed in the URL and I (think) I am checking the URL string for the question mark. THe idea is that if the URL makes the gmt_M_is_query return true then we dont try to make that lock file, but it is not triggering the test.

  11. joa-quim commented on Jul 31, 2020

    @joa-quim
    Member

    You are trying to create a file that has question marks in its name

    	Lfile = gmtremote_lockfile (API, (char *)name);
    	if ((fp = fopen (Lfile, "w")) == NULL) {
    		GMT_Report (API, GMT_MSG_ERROR, "Failed to create lock file %s\n", Lfile);
    		return 1;
    	}
    

    and that is not allowed.

  12. PaulWessel commented on Jul 31, 2020

    @PaulWessel
    Contributor

    Well, I am trying not to create that file when it is an URL query:

    	bool query = gmt_M_file_is_query (url);
    	if (!query) {	/* Only make a filename if not a query */
    		Lfile = gmtremote_lockfile (API, file);
    		if ((fp = fopen (Lfile, "w")) == NULL) {
    			GMT_Report (API, GMT_MSG_ERROR, "Failed to create lock file %s\n", Lfile);
    			return 1;
    		}
    		gmtlib_file_lock (GMT, fileno(fp));	/* Attempt exclusive lock */
    	}
    

    So clearly query is false for this case and I dont know why.

  13. joa-quim commented on Jul 31, 2020

    @joa-quim
    Member

    No, query is true. I told you the error message is not coming from that function but from gmt_download_file() where it tries to create a file with a question mark.

  14. PaulWessel commented on Jul 31, 2020

    @PaulWessel
    Contributor

    Shits, I must have forgotten to duplicate the test there... OK will fix now. Jeez.

  15. added a commit that references this issue on Jul 31, 2020
    b92210b
  16. joa-quim commented on Jul 31, 2020

    @joa-quim
    Member

    OK, it works now.

  17. PaulWessel commented on Jul 31, 2020

    @PaulWessel
    Contributor

    If I don't get it right on the n'th try, I usually get it right on the m'th try (m > n, sometimes m >> n).

  18. added a commit that references this issue on Jul 31, 2020
    ce79109
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions