-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
tdlib Java example on Windows: fatal error on the latest build (f013f47) #2912
Comments
The example works correctly for me with Java HotSpot(TM) 64-Bit Server VM (build 20.0.1+9-29, mixed mode, sharing). For you it crashes on the first native call to tdjni.dll as if it was built for incompatible JVM. Do you have only OpenJDK installed, or there is also HotSpot? |
I tried to build tdlib using jdk 17 (openjdk 17.0.2+8-86) and jdk 21 (openjdk 21.0.1+12-29). For jdk 21 also got the same error: C:\app\jdk-21.0.1\bin\java.exe -javaagent:C:\app\Idea\lib\idea_rt.jar=56395:C:\app\Idea\bin -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath C:\tdlib\example\out\production\example org.drinkless.tdlib.example.Example |
Could you try to run the example manually from console:
? |
Here is the command output: c:\tdlib21\td\tdlib\bin>cd c:\tdlib21\td\tdlib\bin c:\tdlib21\td\tdlib\bin>java -version c:\tdlib21\td\tdlib\bin>java -Djava.library.path=. org/drinkless/tdlib/example/Example c:\tdlib21\td\tdlib\bin> |
Could you try with have just pushed commit? |
Hi levlam, thank you very much for being willing to help! I tried with the latest pushed commit and still having this issue. The build is properly built for my colleague (at least on jdk 17) and his dlls work for me, the build outputs are pretty much the same. This looks like some local issue specific to my env and related to how the dlls are built. I tried different versions of CMake: 3.29.4 and 3.27.1. Here is the output of the build commands: log.txt. Maybe it will give some hints why the built dlls are causing fatal error on Java application start. Thanks. |
The log contains no errors. The library was built successfully and is of the latest version available. Could you check that you use |
Hi levlam, thank you for checking the logs and confirming that no issues are there. cd <path to tdjni.dll> where <path to tdjni.dll> is the newly generated path during the build. Thank you. |
Despite possible, it is highly unlikely that the issue is caused by a bug in toolchain, for example, in MSVC. It is hard to guess what could be the actual cause, given everything works correctly for me with the latest commit. Could you try to build a Debug version of TDLib and tdjni.dll and check whether it crashes differently? |
You can also try to enable TDLib log with verbosity level 10 by changing the line |
Hello, levlam, sorry for the delay and thanks for the suggestions! Setting logVerbosityLevel did not reveal any changes in the error output. It's interesting that the debug version of the build works (--config Debug). I tried to reinstall MS Visual Studio and CMake several times, it did not work. Still facing the fatal error issue with running example with dlls built on my machine (when using --config Release). For the dlls built by my colleague example app works. Thanks again for the ideas and suggestions! |
What's your MSVC version and your colleague's MSVC version? |
For me:
For colleague:
|
With all the details it now looks like an MSVC 19.40.33811.0 bug. Some other MSVC users have similar issue in other projects, for example, https://developercommunity.visualstudio.com/t/Invalid-code-generation-in-release-1940/10678572. I would suggest to downgrade MSVC if possible, or wait for the issue to be investigated by MSVC team and use the working dll in the meanwhile. |
thanks, @levlam! I'll check if MSVC can be downgraded or will try later (future) versions of MSVC to see if the issue is resolved there. |
The https://developercommunity.visualstudio.com/t/Invalid-code-generation-in-release-1940/10678572 issue also mentions the possible cause of the crash now:
Given that you have MSVC installed, it would be strange, if msvcp140.dll is from an old MSVC version, but this is listed as the only expected cause of the crash. It also mentions a workaround. Namely, you can add the line Line 354 in b102c3a If this helps, then the crash happens because of the ABI change in MSVC 19.40.33811.0. |
hello sir @levlam , im facing the same issue, how to fix it: A fatal error has been detected by the Java Runtime Environment:EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffc5adf92a0, pid=14792, tid=14228JRE version: OpenJDK Runtime Environment Temurin-11.0.12+7 (11.0.12+7) (build 11.0.12+7)Java VM: OpenJDK 64-Bit Server VM Temurin-11.0.12+7 (11.0.12+7, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)Problematic frame:C [msvcp140.dll+0x192a0]No core dump will be written. Minidumps are not enabled by default on client versions of WindowsAn error report file with more information is saved as:D:\Dev\Projects\TelegramLib\td\hs_err_pid14792.logIf you would like to submit a bug report, please visit:https://github.com/adoptium/adoptium-support/issuesThe crash happened outside the Java Virtual Machine in native code.See problematic frame for where to report the bug. |
@nguyenkatd |
Thanks much, already resolved it @levlam , now im trying to find some ways to import the lib to my spring boot project. Do you have some tutorials about it ? |
@nguyenkatd No, but this isn't different from any other shared library with JNI interface. |
Worked for me. thanks. |
添加了还是错误 |
Hi tdlib community,
I am currently experiencing issues in running Example on the latest tdlib build.
The build was performed from the following git commit: Add separate tl_generate_mtproto target..
Error:
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff833ae32a8, pid=5372, tid=33568
#
# JRE version: OpenJDK Runtime Environment (21.0.1+12) (build 21.0.1+12-29)
# Java VM: OpenJDK 64-Bit Server VM (21.0.1+12-29, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# C [msvcp140.dll+0x132a8]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
--------------- S U M M A R Y ------------
Command Line: -javaagent:C:\app\Idea\lib\idea_rt.jar=60062:C:\app\Idea\bin -Dfile.encoding=UTF-8 org.drinkless.tdlib.example.Example
Windows 11 , 64 bit Build 22621 (10.0.22621.3672)
Time: Mon Jun 3 22:23:01 2024 Belarus Standard Time elapsed time: 0.236629 seconds (0d 0h 0m 0s)
--------------- T H R E A D ---------------
Current thread (0x0000025a6e603320): JavaThread "main" [_thread_in_native, id=32872, stack(0x000000ae15a00000,0x000000ae15b00000)]
Stack: [0x000000ae15a00000,0x000000ae15b00000], sp=0x000000ae15afea60, free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [msvcp140.dll+0x12c10]
C [tdjni.dll+0x6df168]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.drinkless.tdlib.Client.nativeClientExecute(Lorg/drinkless/tdlib/TdApi$Function;)Lorg/drinkless/tdlib/TdApi$Object;+0
j org.drinkless.tdlib.Client.execute(Lorg/drinkless/tdlib/TdApi$Function;)Lorg/drinkless/tdlib/TdApi$Object;+1
j org.drinkless.tdlib.example.Example.main([Ljava/lang/String;)V+19
v ~StubRoutines::call_stub
siginfo: EXCEPTION_ACCESS_VIOLATION (0xc0000005), reading address 0x0000000000000000
Could you, please, check this issue?
Thank you.
The text was updated successfully, but these errors were encountered: