Skip to content
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

gmi push hangs sometimes #83

Closed
mturquette opened this issue May 30, 2018 · 13 comments
Closed

gmi push hangs sometimes #83

mturquette opened this issue May 30, 2018 · 13 comments
Labels

Comments

@mturquette
Copy link

I have a cron job (documented in #82 ) that calls gmi pull, modifies some tags and then calls gmi push. For debug purposes I print out date(1) in between each of those steps.

Now that the unicode character issue is resolved my cron job is almost working reliably! I still get occasional hangs in gmi push.

Below is the log for when it failed yesterday. You can see after the first date that we start to gmi pull and receive the "done" at the end of the "receiving metadata" progress bar. The second date is an initial tagging script that we can ignore. The third date shows the call to gmi push. We fail to receive the "done" at the end o the metadata fetch, and then we get a lock collision:

Tue May 29 13:00:03 PDT 2018
pull: partial synchronization.. (hid: 40921234)
fetching changes ...done: 26 its in 00.000s
resolving changes (26) .....done: 26 its in 00.000s
receiving content (21) ...remote: could not find remote message: 163ad76a8d4e57cb!
..done: 20 its in 02.145s
current historyId: 40921998
Tue May 29 13:00:16 PDT 2018
Tue May 29 13:14:12 PDT 2018
receiving metadata (4632) ............................................................................................................

Tue May 29 13:31:19 PDT 2018
Traceback (most recent call last):
  File "/Users/mturquette/src/gmailieer/lieer/local.py", line 172, in load_repository
    fcntl.lockf (self.lckf, fcntl.LOCK_EX | fcntl.LOCK_NB)
BlockingIOError: [Errno 35] Resource temporarily unavailable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mturquette/src/gmailieer/gmi", line 8, in <module>
    g.main ()
  File "/Users/mturquette/src/gmailieer/lieer/gmailieer.py", line 149, in main
    args.func (args)
  File "/Users/mturquette/src/gmailieer/lieer/gmailieer.py", line 314, in pull
    self.setup (args, args.dry_run, True)
  File "/Users/mturquette/src/gmailieer/lieer/gmailieer.py", line 202, in setup
    self.local.load_repository ()
  File "/Users/mturquette/src/gmailieer/lieer/local.py", line 174, in load_repository
    raise Local.RepositoryException ("failed to lock repository (probably in use by another gmi instance)")
lieer.local.RepositoryException: failed to lock repository (probably in use by another gmi instance)

Any thoughts on what is going wrong? After the above sequence occurs, the push process hangs forever and must be manually killed. When this happens in the evening I have hours worth of logs showing that the whole process fails due to the lock collision. Each morning I invariably have to kill the gmi push process manually. Usually something like:

 $ ps -e | grep gmi; ps -e | grep notmuch
48742 ??         0:18.09 /usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python /Users/mturquette/src/gmailieer/gmi push
51895 ttys003    0:00.00 grep --color=auto gmi
 6208 ttys002    0:00.76 tail -f /tmp/gmailieer_patchwork_notmuch.log
51912 ttys003    0:00.00 grep --color=auto notmuch
$ kill 48742

Any idea what causes the hang? In my old offlineimap cron script I used to have to manually kill offlineimap before invoking it. I'd like to avoid that kind of nastiness if possible :-) with gmi. Thanks!

@gauteh
Copy link
Owner

gauteh commented May 30, 2018 via email

@gauteh
Copy link
Owner

gauteh commented May 30, 2018 via email

@mturquette
Copy link
Author

mturquette commented May 31, 2018 via email

@gauteh
Copy link
Owner

gauteh commented May 31, 2018 via email

@gauteh
Copy link
Owner

gauteh commented Jun 5, 2018 via email

@mturquette
Copy link
Author

I have just set it to 1800, which I assume means 30 minutes (corresponding to the frequency of my cron job).

According to the usage output, a value of 0 means to use the system timeout, which is not forever on macos, but instead 2 hours IIUC. Can you clarify?

$ gmi set --help
usage: Gmailieer set [-h] [-c CREDENTIALS] [-s] [-t TIMEOUT]
                     [--replace-slash-with-dot] [--no-replace-slash-with-dot]
                     [--drop-non-existing-labels]
                     [--no-drop-non-existing-labels]
                     [--ignore-tags IGNORE_TAGS]

set option

optional arguments:
  -h, --help            show this help message and exit
  -c CREDENTIALS, --credentials CREDENTIALS
                        optional credentials file for google api
  -s, --no-progress     Disable progressbar (always off when output is not
                        TTY)
  -t TIMEOUT, --timeout TIMEOUT
                        Set HTTP timeout in seconds (0 means system timeout)
  --replace-slash-with-dot
                        This will replace '/' with '.' in gmail labels (make
                        sure you realize the implications)
  --no-replace-slash-with-dot
  --drop-non-existing-labels
                        Allow missing labels on the GMail side to be dropped
                        (see https://github.com/gauteh/gmailieer/issues/48)
  --no-drop-non-existing-labels
  --ignore-tags IGNORE_TAGS
                        Set custom tags to ignore (comma-separated)

I'll update this ticket on Friday and let you know if the problem is resolved. Thanks!

@gauteh
Copy link
Owner

gauteh commented Jun 6, 2018 via email

@gauteh
Copy link
Owner

gauteh commented Jun 6, 2018

I think it is the same as the socket timeout. Also: httplib2 docs.

httplib2/httplib2#104

@mturquette
Copy link
Author

mturquette commented Jun 6, 2018 via email

@gauteh
Copy link
Owner

gauteh commented Jun 7, 2018 via email

@mturquette
Copy link
Author

mturquette commented Jun 8, 2018 via email

@gauteh
Copy link
Owner

gauteh commented Jun 9, 2018 via email

@gauteh
Copy link
Owner

gauteh commented Jun 12, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants