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

Library hangs on MacOS 10.13.5 #225

Closed
williamcrossover opened this issue Jun 5, 2018 · 50 comments · Fixed by kwhat/libuiohook#184
Closed

Library hangs on MacOS 10.13.5 #225

williamcrossover opened this issue Jun 5, 2018 · 50 comments · Fixed by kwhat/libuiohook#184
Assignees

Comments

@williamcrossover
Copy link

After updating to MacOS 10.13.5, the library eventually hangs the system.

How to reproduce:

  1. Run the provided sample application in this library "ant run" v2.1.0 and let it run for a few hours. The system eventually starts to crawl and mouse pointer hangs, windows hangs.
  2. If the sample application is killed, everything goes back to normal.

To get the same effect (so you can observe and reproduce the issue more quickly), run v2.0.3 sample application and the issue appears in minutes.

Any ideas on the issue @kwhat ?
Thanks!

@MFoly
Copy link

MFoly commented Jun 5, 2018

Every time system is freezing we have an event that WindowServer process is hanging.
Sample form system report

Thread 0x73e3b            DispatchQueue 85          7 samples (1-7)           priority 37 (base 37)
  <thread QoS user initiated (requested user interactive, ipc override user interactive), IO tier 0>
  7  start_wqthread + 13 (libsystem_pthread.dylib + 11241) [0x7fff771e5be9] 1-7
    7  _pthread_wqthread + 980 (libsystem_pthread.dylib + 12242) [0x7fff771e5fd2] 1-7
      7  _dispatch_workloop_worker_thread + 880 (libdispatch.dylib + 109857) [0x7fff76eadd21] 1-7
        7  _dispatch_root_queue_drain_deferred_wlh + 332 (libdispatch.dylib + 93965) [0x7fff76ea9f0d] 1-7
          7  _dispatch_queue_invoke + 373 (libdispatch.dylib + 37222) [0x7fff76e9c166] 1-7
            7  _dispatch_queue_serial_drain + 222 (libdispatch.dylib + 90234) [0x7fff76ea907a] 1-7
              7  _dispatch_source_invoke + 620 (libdispatch.dylib + 16513) [0x7fff76e97081] 1-7
                7  _dispatch_continuation_pop + 472 (libdispatch.dylib + 85633) [0x7fff76ea7e81] 1-7
                  7  _dispatch_client_callout + 8 (libdispatch.dylib + 7608) [0x7fff76e94db8] 1-7
                    7  __IOHIDEventSystemClientScheduleWithDispatchQueue_block_invoke + 219 (IOKit + 326228) [0x7fff518c7a54] 1-7
                      7  __IOHIDEventSystemClientQueueCallback + 277 (IOKit + 326546) [0x7fff518c7b92] 1-7
                        7  event_system_callback(void*, void*, void*, __IOHIDEvent*) + 201 (SkyLight + 120504) [0x7fff70d166b8] 1-7
                          7  hid_translation_state_append_hid_event(hid_translation_state_t*, __IOHIDEvent*) + 2549 (SkyLight + 2113396) [0x7fff70efcf74] 1-7
                            7  hid_translation_state_append_hid_event(hid_translation_state_t*, __IOHIDEvent*) + 3848 (SkyLight + 2114695) [0x7fff70efd487] 1-7
                              7  CursorTrackingInfo::updateCursorPosition(CGPoint, CGPoint (*)(CGPoint)) + 364 (SkyLight + 2450274) [0x7fff70f4f362] 1-7
                                7  _EVGSetMouseLocation + 138 (SkyLight + 898862) [0x7fff70dd472e] 1-7
                                  7  IOHIDSetFixedMouseLocation + 83 (IOKit + 224706) [0x7fff518aedc2] 1-7
                                    7  IOConnectCallMethod + 186 (IOKit + 15316) [0x7fff5187bbd4] 1-7
                                      7  io_connect_method + 369 (IOKit + 15783) [0x7fff5187bda7] 1-7
                                        7  mach_msg_trap + 10 (libsystem_kernel.dylib + 78346) [0x7fff7701520a] 1-7
                                         *7  hndl_mach_scall64 + 22 (kernel + 129414) [0xffffff800021f986] 1-7
                                           *7  mach_call_munger64 + 509 (kernel + 1517245) [0xffffff80003726bd] 1-7
                                             *7  mach_msg_overwrite_trap + 891 (kernel + 402667) [0xffffff80002624eb] 1-7
                                               *7  ipc_kmsg_send + 189 (kernel + 326109) [0xffffff800024f9dd] 1-7
                                                 *7  ipc_kobject_server + 304 (kernel + 468608) [0xffffff8000272680] 1-7
                                                   *7  ??? (kernel + 1325972) [0xffffff8000343b94] 1-7
                                                     *7  is_io_connect_method + 535 (kernel + 7120311) [0xffffff80008ca5b7] 1-7
                                                       *7  IOUserClient::externalMethod(unsigned int, IOExternalMethodArguments*, IOExternalMethodDispatch*, OSObject*, void*) + 832 (kernel + 7084848) [0xffffff80008c1b30] 1-7
                                                         *7  shim_io_connect_method_structureI_structureO + 457 (kernel + 7092649) [0xffffff80008c39a9] 1-7
                                                           *7  IOCommandGate::runAction(int (*)(OSObject*, void*, void*, void*, void*), void*, void*, void*, void*) + 73 (kernel + 6925545) [0xffffff800089ace9] 1-7
                                                             *7  IOWorkLoop::closeGate() + 37 (kernel + 6912773) [0xffffff8000897b05] 1-7
                                                               *7  lck_mtx_lock + 653 (kernel + 121517) [0xffffff800021daad] 1-7
                                                                 *7  lck_mtx_lock_wait_x86 + 486 (kernel + 1577190) [0xffffff80003810e6] 1-7
                                                                   *7  thread_block_reason + 175 (kernel + 554463) [0xffffff80002875df] 1-7
                                                                     *7  ??? (kernel + 558618) [0xffffff800028861a] 1-7
                                                                       *7  machine_switch_context + 205 (kernel + 1586045) [0xffffff800038337d] (blocked by kernel mutex owned by JavaAppLauncher (NativeHookApp) [12506] thread 0x6d6e3) 1-7

And this is the dump for thread 0x6d6e3

  2002 Thread_448227: Java: JNativeHook Hook Thread
    + 2002 hook_get_multi_click_time  (in libJNativeHook-2.1.0.x86_64.dylib) + 69  [0x124b733d5]
    +   2002 IOServiceOpen  (in IOKit) + 36  [0x7fff5187b6ac]
    +     2002 io_service_open_extended  (in IOKit) + 131  [0x7fff5187b73f]
    +       2002 mach_msg  (in libsystem_kernel.dylib) + 60  [0x7fff77014724]
    +         2002 mach_msg_trap  (in libsystem_kernel.dylib) + 10  [0x7fff7701520a]

@kwhat
Copy link
Owner

kwhat commented Jun 5, 2018

Well, it looks like there is a deadlock between the dispatch thread and the hook_get_multi_click_time function. There is a lot of stupid threading going on to work with the functions to get the key char because the function for OSX can only run on the main thread. Most of this crap is not documented by Apple, and I do not have access to a mac that is capable of running 10.13 so I cannot debug.

For the 0x6d6e3 thread, things are hanging on line 461. My guess is that 0x73e3b is hanging around line 226. Apple has a nasty habit of changing the way POSIX APIs work in conjunction with their overly complex "frameworks."

If one of you could set the log level to DEBUG and paste the log output here, it may help narrow down what's going on.

@kwhat
Copy link
Owner

kwhat commented Jun 5, 2018

A little more update:

I remember implementing this thread mess because this library was using C and I could not call the Objective-C dispatch_async function due to the lack of block support. Later, Iván Munsuri Ibáñez made a contribution that lead to the Obj-C Runtime Library which you can call from C. I think all of these mutexs can be replaced with imp_implementationWithBlock to somehow translate a function pointer to a block.

@kwhat kwhat self-assigned this Jun 6, 2018
@kwhat kwhat added the bug label Jun 6, 2018
@kwhat kwhat added this to the 2.1.1 milestone Jun 6, 2018
@kwhat kwhat added the vcs label Jun 6, 2018
@kwhat kwhat closed this as completed in 0ca79a2 Jun 6, 2018
kwhat added a commit that referenced this issue Jun 6, 2018
@kwhat kwhat reopened this Jun 6, 2018
@kwhat
Copy link
Owner

kwhat commented Jun 6, 2018

@MFoly how did you generate that trace?

@shoaib-xo
Copy link

@kwhat It seems that this fix is failing to capture any key or mouse movement for older MacOS versions.

@kwhat
Copy link
Owner

kwhat commented Jun 6, 2018

Which versions? The oldest I have is 10.7. I made several amended commits over the last two hours so make sure you are using the latest srcs. I have been able to stop the Tap timeout error and click count should work correctly now. Latest HASH 0ae5800

@shoaib-xo
Copy link

Tested on 10.13.4 and 10.12.6 and same results. Will retry with the latest changes and post results shortly.

@kwhat
Copy link
Owner

kwhat commented Jun 6, 2018

Make sure you remove the library from the temp folder.

@FD-
Copy link
Contributor

FD- commented Jun 6, 2018

Hi there!
I was also seeing the same issue since updating to High Sierra, and was delighted to see you're already working on fixing it! I compiled the latest code and haven't seen any freeze since, so fingers crossed that bug is fixed!

Unfortunately, it seems like something in the newest commits broke global key events. Although they seem to work in your example application, they don't in this simple program:

public class Main {
    public static void main(String[] args) {
        try {
            GlobalScreen.registerNativeHook();
        } catch (NativeHookException ex) {
            System.err.println("There was a problem registering the native hook.");
        }

        NativeKeyListener keyListener = new NativeKeyListener() {
            @Override
            public void nativeKeyPressed(NativeKeyEvent nativeKeyEvent) {
                System.out.print("\n\n Pressed \n\n");
            }

            @Override
            public void nativeKeyReleased(NativeKeyEvent nativeKeyEvent) {
                System.out.print("\n\n Released \n\n");
            }

            @Override
            public void nativeKeyTyped(NativeKeyEvent nativeKeyEvent) {

            }
        };

        GlobalScreen.addNativeKeyListener(keyListener);
        Scanner scanner = new Scanner(System.in);
        scanner.next();
    }
}

The program prints key events when using JNativeHook 2.1.0, but doesn't with the newest code.
Please let me know if there's any way I can help debug this issue!

@rmoawad
Copy link

rmoawad commented Jun 6, 2018

@FD- I have tested your example after adding this line after attaching the listener and it works fine:
GlobalScreen.setEventDispatcher(new SwingDispatchService());

We had the same issue.

@FD-
Copy link
Contributor

FD- commented Jun 6, 2018

@rmoawad Thanks, that did the trick! I wonder if this is a bug or an intentional change.

@shoaib-xo
Copy link

Are the fixes available publicly? Unfortunately, the provided fix has broken code for Linux.

Exception in thread "pool-4-thread-1" java.lang.UnsatisfiedLinkError: org.jnativehook.GlobalScreen.getAutoRepeatRate()Ljava/lang/Integer;
	at org.jnativehook.GlobalScreen.getAutoRepeatRate(Native Method)
	at org.jnativehook.GlobalScreen.<clinit>(Unknown Source)
	

@kwhat
Copy link
Owner

kwhat commented Jun 25, 2018

I didn't build the other platforms into the library, only osx. You can extract the public lib folder from the jar and copy the other platforms to the new jar. I am still working on getting an OS X toolchain working and it is getting close.

@Quesadilla1
Copy link

Thank god i found this. have been debugging my stuff for days, thinking it was something i had done.
Is there a working build that fixes this? Willing to pay 30$ since i dont understand this stuff.

@howtimeflies-io
Copy link

howtimeflies-io commented Aug 6, 2018

Hi @kwhat

This issue is still happening with your changes in the commit 7a82ecd6 .

It freezes the system for a few seconds for every mouse clicking /wheeling which my application registered the listeners to.
But it is fine to move the mouse since it is not listened in my application.

Could you please find some time to check it?
Thank you!


Here is the relevant system report (similar to the ones posted above by MFoly):

Date/Time:       2018-08-06 09:59:44 +0800
OS Version:      Mac OS X 10.13.6 (Build 17G65)
Architecture:    x86_64h
Report Version:  26


  Thread 0x1945bd           DispatchQueue 76          11 samples (1-11)         priority 37 (base 37)
  <thread QoS user initiated (requested user interactive, ipc override user interactive), IO tier 0>
  11  start_wqthread + 13 (libsystem_pthread.dylib + 11241) [0x7fff578ccbe9] 1-11
    11  _pthread_wqthread + 980 (libsystem_pthread.dylib + 12242) [0x7fff578ccfd2] 1-11
      11  _dispatch_workloop_worker_thread + 880 (libdispatch.dylib + 109857) [0x7fff57594d21] 1-11
        11  _dispatch_root_queue_drain_deferred_wlh + 332 (libdispatch.dylib + 93965) [0x7fff57590f0d] 1-11
          11  _dispatch_queue_invoke + 373 (libdispatch.dylib + 37222) [0x7fff57583166] 1-11
            11  _dispatch_queue_serial_drain + 222 (libdispatch.dylib + 90234) [0x7fff5759007a] 1-11
              11  _dispatch_source_invoke + 620 (libdispatch.dylib + 16513) [0x7fff5757e081] 1-11
                11  _dispatch_continuation_pop + 472 (libdispatch.dylib + 85633) [0x7fff5758ee81] 1-11
                  11  _dispatch_client_callout + 8 (libdispatch.dylib + 7608) [0x7fff5757bdb8] 1-11
                    11  __IOHIDEventSystemClientScheduleWithDispatchQueue_block_invoke + 219 (IOKit + 325428) [0x7fff31f80734] 1-11
                      11  __IOHIDEventSystemClientQueueCallback + 277 (IOKit + 325746) [0x7fff31f80872] 1-11
                        11  event_system_callback(void*, void*, void*, __IOHIDEvent*) + 201 (SkyLight + 119880) [0x7fff513fb448] 1-11
                          11  hid_translation_state_append_hid_event(hid_translation_state_t*, __IOHIDEvent*) + 2549 (SkyLight + 2112776) [0x7fff515e1d08] 1-11
                            11  hid_translation_state_append_hid_event(hid_translation_state_t*, __IOHIDEvent*) + 3848 (SkyLight + 2114075) [0x7fff515e221b] 1-11
                              11  CursorTrackingInfo::updateCursorPosition(CGPoint, CGPoint (*)(CGPoint)) + 364 (SkyLight + 2449984) [0x7fff51634240] 1-11
                                11  _EVGSetMouseLocation + 138 (SkyLight + 898166) [0x7fff514b9476] 1-11
                                  11  IOHIDSetFixedMouseLocation + 83 (IOKit + 223906) [0x7fff31f67aa2] 1-11
                                    11  IOConnectCallMethod + 186 (IOKit + 14036) [0x7fff31f346d4] 1-11
                                      11  io_connect_method + 369 (IOKit + 14503) [0x7fff31f348a7] 1-11
                                        11  mach_msg_trap + 10 (libsystem_kernel.dylib + 78346) [0x7fff576fc20a] 1-11
                                         *11  hndl_mach_scall64 + 22 (kernel + 125414) [0xffffff800021e9e6] 1-11
                                           *11  mach_call_munger64 + 509 (kernel + 1513245) [0xffffff800037171d] 1-11
                                             *11  mach_msg_overwrite_trap + 891 (kernel + 398667) [0xffffff800026154b] 1-11
                                               *11  ipc_kmsg_send + 189 (kernel + 322109) [0xffffff800024ea3d] 1-11
                                                 *11  ipc_kobject_server + 304 (kernel + 464608) [0xffffff80002716e0] 1-11
                                                   *11  ??? (kernel + 1321972) [0xffffff8000342bf4] 1-11
                                                     *11  is_io_connect_method + 535 (kernel + 7120231) [0xffffff80008ca567] 1-11
                                                       *11  IOUserClient::externalMethod(unsigned int, IOExternalMethodArguments*, IOExternalMethodDispatch*, OSObject*, void*) + 832 (kernel + 7084768) [0xffffff80008c1ae0] 1-11
                                                         *11  shim_io_connect_method_structureI_structureO + 457 (kernel + 7092569) [0xffffff80008c3959] 1-11
                                                           *11  IOCommandGate::runAction(int (*)(OSObject*, void*, void*, void*, void*), void*, void*, void*, void*) + 73 (kernel + 6925433) [0xffffff800089ac79] 1-11
                                                             *11  IOWorkLoop::closeGate() + 37 (kernel + 6912661) [0xffffff8000897a95] 1-11
                                                               *11  lck_mtx_lock + 653 (kernel + 117517) [0xffffff800021cb0d] 1-11
                                                                 *11  lck_mtx_lock_wait_x86 + 486 (kernel + 1575750) [0xffffff8000380b46] 1-11
                                                                   *11  thread_block_reason + 175 (kernel + 550463) [0xffffff800028663f] 1-11
                                                                     *11  ??? (kernel + 554618) [0xffffff800028767a] 1-11
                                                                       *11  machine_switch_context + 205 (kernel + 1584605) [0xffffff8000382ddd] (blocked by kernel mutex owned by io.howtimeflies.client.HowTimeFliesApp [31774] thread 0x18bd0b) 1-11

Thread 0x18bd0b           Thread name "Java: JNativeHook Hook Thread"         11 samples (1-11)         priority 37 (base 31)
  <thread QoS default (requested default), process unclamped, process received importance donation from WindowServer [240], IO tier 0>
  11  hook_get_multi_click_time + 69 (libJNativeHook-2.1.0.x86_64.dylib + 25557) [0x10cd113d5] 1-11
    11  IOServiceOpen + 36 (IOKit + 12716) [0x7fff31f341ac] 1-11
      11  io_service_open_extended + 131 (IOKit + 12863) [0x7fff31f3423f] 1-11
        11  mach_msg_trap + 10 (libsystem_kernel.dylib + 78346) [0x7fff576fc20a] 1-11
         *11  hndl_mach_scall64 + 22 (kernel + 125414) [0xffffff800021e9e6] 1-11
           *11  mach_call_munger64 + 509 (kernel + 1513245) [0xffffff800037171d] 1-11
             *11  mach_msg_overwrite_trap + 891 (kernel + 398667) [0xffffff800026154b] 1-11
               *11  ipc_kmsg_send + 189 (kernel + 322109) [0xffffff800024ea3d] 1-11
                 *11  ipc_kobject_server + 304 (kernel + 464608) [0xffffff80002716e0] 1-11
                   *11  ??? (kernel + 1320610) [0xffffff80003426a2] 1-11
                     *11  is_io_service_open_extended + 279 (kernel + 7116199) [0xffffff80008c95a7] 1-11
                       *11  IOHIDSystem::newUserClient(task*, void*, unsigned int, OSDictionary*, IOUserClient**) + 79 (IOHIDFamily + 185149) [0xffffff7f80f7933d] 1-11
                         *11  IOCommandGate::runAction(int (*)(OSObject*, void*, void*, void*, void*), void*, void*, void*, void*) + 312 (kernel + 6925672) [0xffffff800089ad68] 1-11
                           *11  IOHIDSystem::newUserClientGated(task*, void*, unsigned int, OSDictionary*, IOUserClient**) + 244 (IOHIDFamily + 185438) [0xffffff7f80f7945e] 1-11
                             *11  IOService::attach(IOService*) + 357 (kernel + 6732997) [0xffffff800086bcc5] 1-11
                               *11  thread_block_reason + 175 (kernel + 550463) [0xffffff800028663f] 1-11
                                 *11  ??? (kernel + 554618) [0xffffff800028767a] 1-11
                                   *11  machine_switch_context + 205 (kernel + 1584605) [0xffffff8000382ddd] 1-11

And this is the console output on my application shutdown:


Aug 06, 2018 9:59:36 AM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: process_button_released [830]: Button 1 released 1 time(s). (1473, 853)

Aug 06, 2018 9:59:36 AM org.jnativehook.GlobalScreen$NativeHookThread enable
INFO: process_button_released [851]: Button 1 clicked 1 time(s). (1473, 853)

Aug 06, 2018 9:59:51 AM org.jnativehook.GlobalScreen$NativeHookThread enable
WARNING: hook_event_proc [1090]: CGEventTap timeout!

2018-08-06 09:59:51,859 Thread-0                         INFO  i.h.c.HowTimeFliesApp            Application shutting down

@hendriks73
Copy link

Thanks for working on this!
A fix for this along with a proper, new release would be much appreciated.

@gershkovich
Copy link

A fix for this bug would be much appreciated!
Meanwhile, had to stop using it on OS X 10.13.6. I can assist with testing it if that will help.

@howtimeflies-io
Copy link

@hendriks73 @gershkovich

My temporary workaround is returning a fixed number in this line .

-       long clicktime = hook_get_multi_click_time();
+       // long clicktime = hook_get_multi_click_time();
+       long clicktime = 1000;

1000ms for the double click interval is a good number for me, since my application does not need to precisely identify a mouse clicking is a single one or a double one.

Hopefully this workaround could help you.

@gershkovich
Copy link

@gershkovich @hendriks73
Thanks for the tip!
I used compiled jar from Maven. I am trying to avoid the pain of compiling it locally.
Any documentation that you can recommend? (I actually tried to follow the docs here but quickly failed – my compiled version did not work).

@vahagnsargsian
Copy link

I use maven dependency

com.1stleg
jnativehook
2.1.0

is there a new version which will work on latest macos without hanging?

if no what I can do to make the library work on latest macos, is there any jar file to download and use as library?

@howtimeflies-io
Copy link

@gershkovich @vahagnsargsian

Please try my compiled jar with my local changes mentioned in the above comment if you like.

Note:

  • it was compiled following this wiki page
  • it works only on macOS since it's not cross-platform compiled

@vahagnsargsian
Copy link

thank you,
when do you think there will be an update so I can update by maven dependency and get crossplatform working version (which will not hang on mac), as before?

my software is depending on this library, I am not able to go to any other alternative and this is really urgent, so hope you will help me and other users with making new version

so when we can hope to have that update? ))

@MaxEgg
Copy link

MaxEgg commented Oct 7, 2018

@howtimeflies-io
I tested your compiled jar but for unknown reasons when i add a NativeKeyListener, the listener is not catching any events, but it's not crashing anymore and the logging works. The same code works when I use the maven dependency.

@FD-
Copy link
Contributor

FD- commented Mar 21, 2019

@macdevign The line
GlobalScreen.setEventDispatcher(new SwingDispatchService());
is just meant to fix the issue that keys are not captured.

The hang issue is solved by separate changes in the jnativehook code itself. Building the library from the sources of this repository should fix them.

I suggest you read through all the information in the issue discussion above. All I just wrote is already covered.

@hptruong93
Copy link

I created a quick replacement library for JNativeHook that offers simplified functionalities. You might find this helpful while waiting for next release to fix this.
https://github.com/repeats/SimpleNativeHooks

@hendriks73
Copy link

Nice.
Two questions:

  1. Does SimpleNativeHooks support media keys properly?
  2. Any chance you could contribute to JNativeHook to (finally) fix it?

Thank you!

@hptruong93
Copy link

  1. What OS are you running? The low level native codes should support all keys. However, I do not have native key code mappings to convert that into the Java AWT KeyEvent. You can run the low level native binary on the respective OS and let me know what are the key codes for the multimedia keys. Just open a bug on the repo and I'll add the details.
  2. I'm not sure what the problem in JNativeHook. Even if I could contribute, I'm not in control of the release of the fix.

@kwhat
Copy link
Owner

kwhat commented Apr 22, 2019 via email

@hendriks73
Copy link

@hptruong93

  1. macOS 10.14. — I'll simply try it out.

@kolovos
Copy link

kolovos commented Jul 9, 2019

I've built the jnativehook jar from source (had to delete src/java/module-info.java for it to build under OpenJDK 8) on my Mac and my application has been working without freezes for the last couple of days. A copy of the jar is in https://github.com/kolovos/minigen/blob/master/io.dimitris.minigen/lib/jnativehook-2.1.20190707.jar in case it's useful to anyone else.

@boogie666
Copy link

any chance we can get this on maven central? maybe a 2.1.1 ?
the snapshot repos don't seem to be working (i.e. there nothing there :P)

@kwhat
Copy link
Owner

kwhat commented Oct 21, 2019 via email

@kwhat
Copy link
Owner

kwhat commented Oct 21, 2019

IDK Why but non of my artifacts are showing up right now.

@gabriel-dehan
Copy link

Any news on this issue ?

The .jars here https://oss.sonatype.org/content/repositories/snapshots/com/1stleg/jnativehook/2.1.SNAPSHOT/ all give back a 404 so I can't get them, and Maven still doesn't have the 2.1.1 artifact up

Thanks a lot

@kwhat
Copy link
Owner

kwhat commented May 20, 2020

I am working on a new build method for this library using Maven, Cmake and GitHub Actions. Maven is still terrible but it should be done in the coming days.

@kwhat
Copy link
Owner

kwhat commented May 20, 2020

I am pretty sure I know what is causing this issue. It is probably caused by the thread safety around this nonsense. The whole issue revolves around the TIS API requiring that it runs on the Main loop. It may be possible to solve this with blocks. I just got OS X in Virtualbox with the awesome myspaghetti/macos-virtualbox project so I can actually do some testing and debugging for OS X. If any of you want to take a stab at this, please open a pull-request against the maven or 2.2 branch.

@jaysworldofcode
Copy link

jaysworldofcode commented Oct 2, 2020

Fix this by importing this library and adding this line GlobalScreen.setEventDispatcher(new SwingDispatchService()); works like a charm

@kwhat
Copy link
Owner

kwhat commented Oct 2, 2020

Hey Jay, thanks for testing. Which library build is that? Is it part of the 2.2 branch?

@kwhat kwhat modified the milestones: 2.1.1, 2.2.0 Oct 2, 2020
@jaysworldofcode
Copy link

Hey Jay, thanks for testing. Which library build is that? Is it part of the 2.2 branch?

Hi kwhat, sorry this was meant for the hang bug in jnativehook.

@dipeshpatidar

This comment was marked as off-topic.

@kwhat
Copy link
Owner

kwhat commented Sep 27, 2021

@dipeshpatidar if there is still a problem with Big Sur / Monterey, please open a new bug. I currently have no way of running either of these releases so it will be a while before I can take a look.

@kwhat kwhat removed the vcs label Sep 27, 2021
@kwhat kwhat removed this from the 2.2.0 milestone Sep 27, 2021
@kwhat
Copy link
Owner

kwhat commented Feb 18, 2022

Is this still a problem with 2.2.1? Did @jaysworldofcode 's GlobalScreen.setEventDispatcher(new SwingDispatchService()); solution work for you? I don't use an OS X computer so I can't test by leaving it running all day. The latest 2.2 had some reworking of the OS X code that may have resolved this issue.

@dipeshpatidar Your issue is discussed in #359, please add notes to that ticket.

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

Successfully merging a pull request may close this issue.