Issues with FreeBSD 11.3 and OpenJDK (BitBucket)
jasonkafer opened this issue · 2 comments
We recently upgraded BitBucket to 7.1.0 which now utilizes the NuProcess 2.0.0 library. We are getting the following exception on Freebsd 11.3 using OpenJDK8 and OpenJDK11
java.lang.RuntimeException: syscall(SYS__pthread_chdir) failed to set current directory, return code: -1, last error: 45
at com.zaxxer.nuprocess.internal.BasePosixProcess.checkReturnCode(BasePosixProcess.java:648)
at com.zaxxer.nuprocess.osx.OsxProcess.spawnWithCwd(OsxProcess.java:185)
at com.zaxxer.nuprocess.osx.OsxProcess.prepareProcess(OsxProcess.java:151)
at com.zaxxer.nuprocess.osx.OsxProcess.run(OsxProcess.java:107)
at com.zaxxer.nuprocess.osx.OsxProcessFactory.runProcess(OsxProcessFactory.java:43)
at com.zaxxer.nuprocess.NuProcessBuilder.run(NuProcessBuilder.java:273)
at com.atlassian.bitbucket.internal.process.nu.NuNioProcessHelper.run(NuNioProcessHelper.java:75)
After digging into the code, it appears that the issue on FreeBSD is due to the value that is set for the SYS___pthread_chdir value in LibC.java
I am not sure where the value of 348 comes from, but based on the FreeBSD syscall.h (https://github.com/freebsd/freebsd/blob/master/sys/sys/syscall.h) the correct value to pass here is 12. I made a custom build of the library and replaced the library in bitbucket and all is good.
I'll submit a pull request for the change.
Pull request submitted