dacap / keyfreq

Track Emacs commands frequency
320 stars 25 forks source link

Doesn't handle multiple emacs processes being open #10

Open asmeurer opened 10 years ago

asmeurer commented 10 years ago

I regularly use multiple emacs processes (in different terminal tabs), and this causes emacs to constantly complain about the keyfreq file being locked.

dacap commented 10 years ago

This is strange because keyfreq is already prepared to work with multiple emacs processes running in parallel (sometime I commonly do on Windows). Maybe the problem is when a lot of multiples instances are running. How many instances are you using?

I suspect that the problem is in keyfreq-table-save after keyfreq-file-is-unlocked is called. Could you debug it?

asmeurer commented 10 years ago

I haven't been using this since I reported this issue for this reason, but as I recall two instances were enough.

asmeurer commented 10 years ago

Hmm, so I'm not sure how to debug this. I have started seeing the issue again. It comes up during autosave. Is there a way to conditionally enable debug on quit only for that one message?

swarnendubiswas commented 9 years ago

I have faced the same issue and I had three instances open. In fact, enabling keyfreq package did not allow my emacs to quit with C-x C-c. Searching, I found that deleting the keyfreq stat files helped. There were two: one in home with suffix .lock, and the other was the stats file in ~/.emacs.d. Unfortunately I am not certain which file was the culprit. The parens were balanced in the stats file, whereas the .lock file was empty.

I have the same problem on another system. I will check that as well later today.

dacap commented 8 years ago

This problem is still happening in some situations.

dacap commented 8 years ago

Sorry again, but it looks that this issue isn't 100% fixed. I've asked to the Emacs mailing list about this: http://lists.gnu.org/archive/html/help-gnu-emacs/2015-09/msg00359.html

zimoun commented 8 years ago

I have play around and it seems a classical multi-threading issue ?

Let two instances of Emacs, E1 and E2. And basically, when saving the scenario is:

What I do not understand is: in the function keyfreq-file-claim-lock, the call write-region is inside ignore-error, so why Emacs is complaining ?

I have not found the option to tell to Emacs: try to write (emacs-pid) and if you cannot, no complain and pass.

Is it possible ?