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

Intermittently stops working over time, restarting Unshaky usually help #39

Closed
cperezabo opened this issue Mar 11, 2019 · 36 comments
Closed
Labels
bug Something isn't working

Comments

@cperezabo
Copy link

Maybe It's just a feeling, but sometimes I feel unshaky is opened and not working as expected.
I close it, and the open it again and it seems to work correctly again... Could it be possible or it's just a reiterative coincidence? 😕

@aahung
Copy link
Owner

aahung commented Mar 11, 2019

Right now I haven't seen any other incidents yet.

Next time when you feel it does not work, open the debug window and type the same key repeatedly (and quickly). It should print "dismissed" for some events. Otherwise, we can investigate further.

@aahung
Copy link
Owner

aahung commented Mar 11, 2019

And recently I did not release any major changes, neither did Apple do to macOS. So if it works before it should continue to work. 🤔

@nmercuro
Copy link

I have this same issue occasionally where it becomes less effective over time. If I close the app and reopen it the problem goes away. I installed it about a week ago and it completely fixed my issues with the keyboard, then after a day I noticed that the issue had come back, and saw that the app had closed itself. When I turned it back on it worked fine for a while, then suddenly had the same issue again where it stopped working randomly, and I had to close the app again to get it working. Really insane that on a $3500 computer we need an app like this to be able to use the computer without giving our laptop to Apple for several weeks to fix a simple issue.

@nmercuro
Copy link

nmercuro commented Mar 14, 2019

So I ran the debugger while typing t his responsea nd this is the raw output of thekeyboardwithout any typos. I'm not really sure what's going on. It seems like some of the keys are being recorded incorrectly? I fixed all of my own typos. The double spaces and typos are the result of the keyboard with the app running.

Screen Shot 2019-03-13 at 11 21 24 PM

Screen Shot 2019-03-13 at 11 20 38 PM

Screen Shot 2019-03-13 at 11 19 31 PM

@nmercuro
Copy link

nmercuro commented Mar 14, 2019

I tried enabling aggressive mode and changed the delay to 45ms to see if that helped at all. I think the typos were from the delay, but the spaces seem like they stil loccur randomly. Here's a typo that seems like it added a random space in the middle of me typing the word still.
Screen Shot 2019-03-13 at 11 24 22 PM
Screen Shot 2019-03-13 at 11 24 10 PM

@aahung
Copy link
Owner

aahung commented Mar 14, 2019

@nmercuro it closing itself is odd, can you open the Console.app and search for "Unshaky" to see if there is any system log about it? As for the log you post here,

two interesting findings made me suspect your space key sometimes delays response or even not response at all

  • there was no space registered in thekeyboardwithout at all
  • responsea nd

@nmercuro
Copy link

@nmercuro it closing itself is odd, can you open the Console.app and search for "Unshaky" to see if there is any system log about it? As for the log you post here,

two interesting findings made me suspect your space key sometimes delays response or even not response at all

  • there was no space registered in thekeyboardwithout at all
  • responsea nd

Yea, I'm thinking that the space bar is intermittently both not registering keypresses AND registering 2-3 keypresses when there was only 1. Quite frustrating.

@aahung
Copy link
Owner

aahung commented Mar 14, 2019

@nmercuro For the "close itself" part, search "Unshaky" in the console.app to see if there is anything there. Otherwise I will add some crash report feature directly into Unshaky.

@aahung aahung added the bug Something isn't working label Mar 18, 2019
@andreynering
Copy link

andreynering commented Apr 1, 2019

I also noticed this issue.

The app intermittently stops working, but restarting it fixes the issue.

Otherwise that, great app! Thanks for making it @aahung!

@aahung aahung changed the title Maybe stops working? Intermittently stops working over time, restarting Unshaky usually help Apr 1, 2019
@aahung
Copy link
Owner

aahung commented Apr 1, 2019

We had a little discussion in #40 and implementing some "recovery mechanism" is a feasible workaround.

@chmac
Copy link

chmac commented Apr 1, 2019

@aahung I see no mentions of unshaky in my console. Unshaky is currently in a broken state. I'm looking in the "Devices" tab for this machine. If you'd like me to check any other logs in the console, just let me know.

aahung added a commit that referenced this issue Apr 1, 2019
aahung added a commit that referenced this issue Apr 1, 2019
@aahung
Copy link
Owner

aahung commented Apr 1, 2019

@chmac then it must lose the event tap (listener) naturally (not crashed). I just made some modifications and hope it can resolve the problem. Also I put a simple recovery mechanism, and when you click the Unshaky status bar item, it will be triggered.

Try v0.4.7 (alpha) to see if the issue persists.

@stewartadam
Copy link

In my case I just observed Unshakey not working and the debug window showed no keys being captured. Restart fixed the issue.

@aahung
Copy link
Owner

aahung commented Apr 8, 2019

Can you try v0.4.7? I am not sure if it can be fixed with v0.4.7.

@nmercuro
Copy link

nmercuro commented Apr 9, 2019

Still not working entirely with 0.4.7. Sometimes I reset the app and it works better and other times it doesn't.

@nmercuro
Copy link

nmercuro commented Apr 9, 2019

Here's a nexample of me typing into chrome. What's interesting is that it seems to work better in certain apps? For instance, in chrome, it's dismissing a lot of erroneous keypresses, but in "Spark", the e-mail client I use, almost every other word has an extra space or similar. Perhaps the capture isn't working in certain apps? Is there a way to find out?

log_chrome.txt

@aahung
Copy link
Owner

aahung commented Apr 9, 2019

v0.4.7 implements a mechanism when you click Unshaky in status bar it auto try to recover itself. If clicking Unshaky in status bar has same effect as restarting Unshaky, please let me know, so I can make the rauto-recovery more aggressive.

Perhaps the capture isn't working in certain apps? Is there a way to find out?

I don't think Chrome and Spark could have differences since Unshaky works at a lower level than these applications. Unless we do some controlled study we don't know if this "feel" is consistent over time. When it does not seem to work in Spark, do you have any log?

@nmercuro
Copy link

nmercuro commented Apr 10, 2019 via email

@nmercuro
Copy link

nmercuro commented Apr 10, 2019

I downloaded 0.4.7 to see if it's much better. It seems about the same, so I'm thinking it's probably just the keyboard vs the app. It's hardt o tell exactly what's happening to see what could be implemented to make Unshaky more effective. Here's the raw output of my keyboard whiel typing, along with the log. I only have unshaky enabled for T and Space since those are the main keys that seme to have issues.

log_chrome.txt

@aahung
Copy link
Owner

aahung commented Apr 10, 2019

Seems Unshaky is working as expected for the log you provide. To be honest I don’t know what to look for in your case. The event tapping is obviously on. Maybe in your case Unshaky cannot receive keyboard events properly due to some software conflicts?

@nmercuro
Copy link

nmercuro commented Apr 10, 2019 via email

@nmercuro
Copy link

I've been trying to log a bit more to try and understand what's going on. It seems like based on he log, sometimes they keypresses are out of order? Like the logging or key capture can't keep up with the typing?

For example:

In this string, I typed "Before we". But you can see that the sequence of letters is the following: b press, b release, e press, e release, f press, f release, o press, r press, o release, e press, r release, space press, e release, space release, w press, e press, space press, w release, space release, e release, space press, space release.

1555019811.333214 Key( 58| 11| B| 0| 50) E(10)
1555019811.401580 Key( 58| 11| B| 0| 50) E(11)
1555019811.460874 Key( 58| 14| E| 0| 50) E(10)
1555019811.585818 Key( 58| 14| E| 0| 50) E(11)
1555019811.592602 Key( 58| 3| F| 0| 50) E(10)
1555019811.680805 Key( 58| 3| F| 0| 50) E(11)
1555019811.727324 Key( 58| 31| O| 0| 50) E(10)
1555019811.838524 Key( 58| 15| R| 0| 50) E(10)
1555019811.853695 Key( 58| 31| O| 0| 50) E(11)
1555019811.880326 Key( 58| 14| E| 0| 50) E(10)
1555019811.954074 Key( 58| 15| R| 0| 50) E(11)
1555019811.970077 Key( 58| 49| Space| 0| 60) E(10)
1555019812.001766 Key( 58| 14| E| 0| 50) E(11)
1555019812.062287 Key( 58| 49| Space| 0| 60) E(11)
1555019812.459257 Key( 58| 13| W| 0| 50) E(10)
1555019812.503025 Key( 58| 14| E| 0| 50) E(10)
1555019812.555242 Key( 58| 49| Space| 0| 60) E(10)
1555019812.564932 Key( 58| 13| W| 0| 50) E(11)
1555019812.581575 Key( 58| 49| Space| 0| 60) E(11)
1555019812.627023 Key( 58| 14| E| 0| 50) E(11)
1555019812.654289 Key( 58| 49| Space| 0| 60) E(10)
1555019812.695417 Key( 58| 49| Space| 0| 60) E(11)

I think the issue here is how Unshakey works. Because it's 'listening' for a press and release within a given timeframe, the fact that there are other presses and releases mixed up with legitimate presses and releases seems make it think everything is fine.

Here's another example. In the original text, make had an extra space after it.

You can see in the logging that it didn't catch the double space because the "Press and release" is out of order. M & A were pressed before either was released. That didn't create a problem because those keys aren't duplicating key presses. But when I hit space bar, it doesn't register the release ofthe e key until after it registers the space press and release, which makes it think it's ok to allow the second space since another key has been pressed in between.

One possible solution might be to set up an even more aggressive mode that doesn't allow a keypress at all within a specified period of time, vs allowing the keypress if another key has been pressed in between? Or perhaps only track the "Press" vs caring about the release. This out of order (Happened again here, I'll attach the log below) capture happens every time I get an erroneous space.

I can't think of any reason why the out of order presses would be hardware related, because that would result in out of order typing wouldn't it?

1555020439.058247 Key( 58| 46| M| 0| 42) E(10)
1555020439.142325 Key( 58| 0| A| 0| 42) E(10)
1555020439.152926 Key( 58| 46| M| 0| 42) E(11)
1555020439.225485 Key( 58| 0| A| 0| 42) E(11)
1555020439.244453 Key( 58| 40| K| 0| 42) E(10)
1555020439.360982 Key( 58| 14| E| 0| 42) E(10)
1555020439.368838 Key( 58| 40| K| 0| 42) E(11)
1555020439.421118 Key( 58| 49| Space| 0| 60) E(10)
1555020439.440686 Key( 58| 49| Space| 0| 60) E(11)
1555020439.452354 Key( 58| 14| E| 0| 42) E(11)
1555020439.515128 Key( 58| 49| Space| 0| 60) E(10)
1555020439.538890 Key( 58| 49| Space| 0| 60) E(11)

1555020935.240266 Key( 58| 31| O| 0| 42) E(11)
1555020935.276543 Key( 58| 49| Space| 0| 50) E(10)
1555020935.276601 Key( 58| 32| U| 0| 42) E(11)
1555020935.291551 Key( 58| 49| Space| 0| 50) E(11)
1555020935.316813 Key( 58| 17| T| 0| 42) E(11)
1555020935.351784 Key( 58| 49| Space| 0| 50) E(10)
1555020935.367236 Key( 58| 31| O| 0| 42) E(10)
1555020935.367272 Key( 58| 49| Space| 0| 50) E(11)
1555020935.431723 Key( 58| 3| F| 0| 42) E(10)
1555020935.483918 Key( 58| 31| O| 0| 42) E(11)
1555020935.524238 Key( 58| 3| F| 0| 42) E(11)
1555020935.575767 Key( 58| 49| Space| 0| 50) E(10)
1555020935.604067 Key( 58| 49| Space| 0| 50) E(11)

@aahung
Copy link
Owner

aahung commented Apr 12, 2019

the logging or key capture can't keep up with the typing?: b press, b release, e press, e release, f press, f release, o press, r press, o release, e press, r release, space press, e release, space release, w press, e press, space press, w release, space release, e release, space press, space release

The "out of order presses" scenario you mentioned above is what actually happens when you types. when you press down a key, let's say "w", "w" will be registered, and if you type very fast, you are very likely to press down another key, let's say "e", before you release "w". This is totally normal and you will end up typing "we" as a result, because "pressing" is where macOS register your typing.

because that would result in out of order typing wouldn't it?

I don't think it will result in out of order typing. "press" event is when the letter being typed.

when I hit space bar, it doesn't register the release of the e key until after it registers the space press and release

"hitting space bar" does not necessary release your "e" key. It might be your "e" key not bouncing back instantly, creating a delay.

@aahung
Copy link
Owner

aahung commented Apr 12, 2019

One possible solution might be to set up an even more aggressive mode that doesn't allow a keypress at all within a specified period of time, vs allowing the keypress if another key has been pressed in between

Unshaky treats each key separately and key A's press/release won't affect key B's handling.

Because it's 'listening' for a press and release within a given timeframe

Unshaky does not listen, how it works is totally passive. It only register a handler to macOS's session event loop. When you press a key, macOS will call the handler to decide whether to block it or not.

@aahung
Copy link
Owner

aahung commented Apr 12, 2019

@nmercuro I also looked into your log but without flagging which key presses "should have been but was not blocked", not much I can do to find a pattern. :-(

@nmercuro
Copy link

nmercuro commented Apr 12, 2019 via email

@aahung
Copy link
Owner

aahung commented Apr 12, 2019

@aahung yeah and I can see you already enlarge the delay of space to 60ms. If we can find some extra pattern among your space events we might be able to implement some extra mechanism to counteract it. Otherwise keep enlarging delay of space could alleviate this problem but will block some false positives.

@nmercuro
Copy link

nmercuro commented Apr 12, 2019 via email

@jlhirond
Copy link

WORKAROUND
I've been encountering this issue for several months. I'll notice double spaces show up in typing, and test that it is not working at all with a 1000ms delay. I've determined a workaround for making it work again which has been 100% effective for me is to put my MacBook to sleep, and wake it up again. Note that just restarting the service is typically ineffective, while the sleep method always works for me.

@BobbyC777
Copy link

Is there a way to reset statistics?

@andreynering
Copy link

Is there a way to reset statistics?

Yes, here:

Screen Shot 2019-10-31 at 11 19 09

@BobbyC777
Copy link

@andreynering
Thanks - thought I had tried it but must have mis-clicked!
If Unshaky solves my problems I'm torn between letting Apple tear my newish MacBook Air apart or just going with this software fix. Thanks for the response. (My first GitHub activity)

@andreynering
Copy link

@BobbyC777 You're welcome 😉

@chmac
Copy link

chmac commented Oct 31, 2019

@BobbyC777 Pro tip, replacing the keyboard on a mac laptop usually includes the battery, so you if unshaky solves your problem, you might want to wait until the laptop is a year or three old and then get it serviced by apple! :-)

@BobbyC777
Copy link

BobbyC777 commented Oct 31, 2019 via email

@aahung
Copy link
Owner

aahung commented Sep 23, 2020

close now. We could not find the cause of the issue, neither can I reproduce it. :-(

@aahung aahung closed this as completed Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants