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

Can't use custom Gem (Bad file descriptor) #699

Open
Poundex opened this issue Jan 8, 2024 · 2 comments
Open

Can't use custom Gem (Bad file descriptor) #699

Poundex opened this issue Jan 8, 2024 · 2 comments

Comments

@Poundex
Copy link

Poundex commented Jan 8, 2024

Hello,

I am trying to use a custom Gem but running the prepare JAR task is failing with a strange error:
extconf failed Bad file descriptor - /bin/sh

I can install the Gem successfully with the external Gem command.

Full output:

16:00:07: Executing 'clean asciidoctorGemsJar'...

> Task :clean

> Task :asciidoctorGemsPrepare
2024-01-08T16:00:10.276Z [/127.0.0.1:59950 to /127.0.0.1:38421 workers] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED' to enable.

Successfully installed concurrent-ruby-1.2.2
Successfully installed i18n-1.14.1
Successfully installed ruby-enum-0.9.0
Building native extensions. This could take a while...
ERROR:  Error installing /home/pounder/.gradle/caches/modules-2/files-2.1/rubygems/mathematical/1.6.18/7ca3dcf196407c547dae654654e86f892cb8c493/mathematical-1.6.18.gem:
	ERROR: Failed to build gem native extension.

    current directory: /home/pounder/workspace/3p/d2l-java/build/.asciidoctorGems/gems/mathematical-1.6.18/ext/mathematical
/home/pounder/.sdkman/candidates/java/20-tem/bin/java -cp :/home/pounder/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/9.3.8.0/8e11191265ab501930125081d8c21a3f55f1b8cd/jruby-complete-9.3.8.0.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctor-gradle-jvm-epub/4.0.0/c110459834da386d1e28e6c1873abd0be03a0774/asciidoctor-gradle-jvm-epub-4.0.0.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctor-gradle-jvm-gems/4.0.0/68c1a36d9828b76e4d4fdf09cc75c9ac62c3a121/asciidoctor-gradle-jvm-gems-4.0.0.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctor-gradle-jvm/4.0.0/d7559f3bd9fe8eef8521f0e31d67bf7c77a4bbab/asciidoctor-gradle-jvm-4.0.0.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctor-gradle-base/4.0.0/ebbc22fed8a8f152b954edd9410318e9f06bca5a/asciidoctor-gradle-base-4.0.0.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.ysb33r.gradle.jruby/jrubygradle-resolver/1.0.0/f3fb67db407e21634deb742f1db00d4bd3ba7a06/jrubygradle-resolver-1.0.0.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.ysb33r.gradle/grolifant-herd/2.2.2/e5b7a0b126a5ea4cda4ef2cd1d2b93ebcbeb23f2/grolifant-herd-2.2.2.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.ysb33r.gradle/grolifant80/2.2.2/5f5b27c6c7d5cae6fb2d49b9f46da00dfe0b7d6d/grolifant80-2.2.2.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.ysb33r.gradle/grolifant70/2.2.2/299a226fd304d2755bde366b871771ddf7d85472/grolifant70-2.2.2.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.ysb33r.gradle/grolifant60/2.2.2/af90d5d87e7efeb5eea059c379d9e92395d44790/grolifant60-2.2.2.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.ysb33r.gradle/grolifant50/2.2.2/97f53ac70dd4314b0c711cca0646e09ac2e5798c/grolifant50-2.2.2.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.ysb33r.gradle/grolifant40-legacy-api/2.2.2/53fd44ecfb638e3223a1b167e5ab8bfb0307f59d/grolifant40-legacy-api-2.2.2.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.ysb33r.gradle/grolifant40/2.2.2/ebbe374a81d61f38f092c7817149f18d80911f3f/grolifant40-2.2.2.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.ysb33r.gradle/grolifant-core/2.2.2/891b3262afae6a8a2eae6ed94aad37c01a6336cf/grolifant-core-2.2.2.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.ysb33r.gradle/grolifant-rawhide/2.2.2/749af56246ef16d40fedef7a43ad6899f27ae99c/grolifant-rawhide-2.2.2.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-api/2.5.7/37ea651d5f1ba2ad3d1c09eb2356b17f35c15bb5/asciidoctorj-api-2.5.7.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.tukaani/xz/1.6/5b6f921f1810bdf90e25471968f741f87168b64/xz-1.6.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/io.github.http-builder-ng/http-builder-ng-okhttp/1.0.3/f5a767dc67c1e60daba8cd974007aeef06068fbd/http-builder-ng-okhttp-1.0.3.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/io.ratpack/ratpack-core/1.6.1/5d6041a76c83769f09164d485609c30e26d2a958/ratpack-core-1.6.1.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-nio/3.0.13/bfdc9d5c9ca5dc1efb0f9543dd732b7c20647fcd/groovy-nio-3.0.13.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/io.github.http-builder-ng/http-builder-ng-core/1.0.3/ad2b181931a4c451f8f456c7b5eaffc9fda8fee6/http-builder-ng-core-1.0.3.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/com.burgstaller/okhttp-digest/1.10/ab01486e496bb761888197b3c5c179f49b79d668/okhttp-digest-1.10.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.5.0/4b0bb6bfbecbdd42b97ff400af342bfe7f32bc83/okhttp-3.5.0.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/io.ratpack/ratpack-exec/1.6.1/76566346af31fc2df3a30828d02ab4a76218d25e/ratpack-exec-1.6.1.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec-http/4.1.32.Final/b9218adba7353ad5a75fcb639e4755d64bd6ddf/netty-codec-http-4.1.32.Final.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/io.netty/netty-handler/4.1.32.Final/b4e3fa13f219df14a9455cc2111f133374428be0/netty-handler-4.1.32.Final.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/com.sun.activation/javax.activation/1.2.0/bf744c1e2776ed1de3c55c8dac1057ec331ef744/javax.activation-1.2.0.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/com.github.ben-manes.caffeine/caffeine/2.6.2/c8fd8817f9d2b2ced82f8968e0dd943aab557de0/caffeine-2.6.2.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.22.0-GA/3e83394258ae2089be7219b971ec21a8288528ad/javassist-3.22.0-GA.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-guava/2.9.8/b7f7819800f8ebe51a03dd951636f6dbc6245ce6/jackson-datatype-guava-2.9.8.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.9.8/bcd02aa9195390e23747ed40bf76be869ad3a2fb/jackson-datatype-jdk8-2.9.8.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.9.8/28ad1bced632ba338e51c825a652f6e11a8e6eac/jackson-datatype-jsr310-2.9.8.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.9.8/11283f21cc480aa86c4df7a0a3243ec508372ed2/jackson-databind-2.9.8.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.9.8/a1c807329eb0c75976aeb5961a506b3516ffeae3/jackson-dataformat-yaml-2.9.8.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.yaml/snakeyaml/1.23/ec62d74fe50689c28c0ff5b35d3aebcaa8b5be68/snakeyaml-1.23.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy/3.0.13/7652b22000c2cebbfdcfdf530a64e41baa518cb/groovy-3.0.13.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-collections4/4.4/62ebe7544cb7164d87e0637a2a6a2bdc981395e8/commons-collections4-4.4.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/xml-resolver/xml-resolver/1.2/3d0f97750b3a03e0971831566067754ba4bfd68c/xml-resolver-1.2.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/io.ratpack/ratpack-base/1.6.1/2fd3ffd5fa3bd0e5aed91814cf7e9a8c5b6d56db/ratpack-base-1.6.1.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.25/da76ca59f6a57ee3102f8f9bd9cee742973efa8a/slf4j-api-1.7.25.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio/1.11.0/840897fcd7223a8143f1d9b6f69714e7be34fd50/okio-1.11.0.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-epoll/4.1.32.Final/9261e2930ab30681230a1192878dc2d17525350d/netty-transport-native-epoll-4.1.32.Final-linux-x86_64.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/io.netty/netty-codec/4.1.32.Final/8f32bd79c5a16f014a4372ed979dc62b39ede33a/netty-codec-4.1.32.Final.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport-native-unix-common/4.1.32.Final/3d2aea6a2873b0a6503645dc296bc0ce6d01a25a/netty-transport-native-unix-common-4.1.32.Final.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/io.netty/netty-transport/4.1.32.Final/d5e5a8ff9c2bc7d91ddccc536a5aca1a4355bd8b/netty-transport-4.1.32.Final.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/io.netty/netty-buffer/4.1.32.Final/46ede57693788181b2cafddc3a5967ed2f621c8/netty-buffer-4.1.32.Final.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/org.reactivestreams/reactive-streams/1.0.2/323964c36556eb0e6209f65c1cef72b53b461ab8/reactive-streams-1.0.2.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.9.0/7c10d545325e3a6e72e06381afe469fd40eb701/jackson-annotations-2.9.0.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.9.8/f5a654e4675769c716e5b387830d19b501ca191/jackson-core-2.9.8.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/21.0/3a3d111be1be1b745edfa7d91678a12d7ed38709/guava-21.0.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/io.netty/netty-resolver/4.1.32.Final/3e0114715cb125a12db8d982b2208e552a91256d/netty-resolver-4.1.32.Final.jar:/home/pounder/.gradle/caches/modules-2/files-2.1/io.netty/netty-common/4.1.32.Final/e95de4f762606f492328e180c8ad5438565a5e3b/netty-common-4.1.32.Final.jar org.jruby.Main -I uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib -r ./siteconf20240108-496572-1j6nzcv.rb extconf.rb
extconf failedBad file descriptor - /bin/sh

Gem files will remain installed in /home/pounder/workspace/3p/d2l-java/build/.asciidoctorGems/gems/mathematical-1.6.18 for inspection.
Results logged to /home/pounder/workspace/3p/d2l-java/build/.asciidoctorGems/extensions/universal-java-20/2.6.0/mathematical-1.6.18/gem_make.out
Successfully installed asciimath-2.0.5
Successfully installed asciidoctor-2.0.20
Successfully installed asciidoctor-mathematical-0.3.5
6 gems installed

> Task :asciidoctorGemsJar

BUILD SUCCESSFUL in 11s
3 actionable tasks: 3 executed
16:00:18: Execution finished 'clean asciidoctorGemsJar'.

Even though the task succeeds, there are errors and the subsequent tasks do not work:

16:05:27: Executing 'asciidoctorEpub'...


> Task :asciidoctorEpub FAILED
1 actionable task: 1 executed
2024-01-08T16:05:28.204Z [WorkerExecutor Queue] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED' to enable.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':asciidoctorEpub'.
> A failure occurred while executing org.ysb33r.grolifant.internal.v6.jvm.worker.InternalWorkerAppExecutor
   > org.jruby.exceptions.LoadError: (LoadError) no such file to load -- asciidoctor-mathematical

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1s
16:05:29: Execution finished 'asciidoctorEpub'.

I tried a --no-build-cache workaround from another issue which looked like it might be similar/related, but this had no effect.

Full build.gradle:

plugins {
	id("org.asciidoctor.jvm.convert") version "4.0.0"
	id("org.asciidoctor.jvm.epub") version "4.0.0"
	id("org.asciidoctor.jvm.gems") version "4.0.0"
}

repositories {
	mavenCentral()
	ruby {
		gems()
	}
}

dependencies {
	asciidoctorGems 'rubygems:asciidoctor-mathematical:0.3.5'
}

asciidoctorj {
	requires 'asciidoctor-mathematical'
}

asciidoctor {
	baseDirFollowsSourceFile()
	outputDir = "${project.buildDir}/docs/public"
}

asciidoctorEpub {
	baseDirFollowsSourceFile()
	ebookFormats("EPUB3")
	// TODO: Need to download/inline all images as this doesn't happen automatically :(
//	resources {
//		from('src/docs/asciidoc/images') {
//			include '*.png'
//		}
//		into './images'
//	}
}

assemble.dependsOn(asciidoctor, asciidoctorEpub)

Diag info:

------------------------------------------------------------
Gradle 8.5
------------------------------------------------------------

Build time:   2023-11-29 14:08:57 UTC
Revision:     28aca86a7180baa17117e0e5ba01d8ea9feca598

Kotlin:       1.9.20
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          21 (Eclipse Adoptium 21+35-LTS)
OS:           Linux 6.6.10-arch1-1 amd64

Thank you

@ysb33r
Copy link
Member

ysb33r commented Jan 8, 2024

2024-01-08T16:05:28.204Z [WorkerExecutor Queue] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED' to enable.

This is probably a JDK21-related issue. Unfortunately with asciidoctorGemsPrepare there is no public method to access the fork options at present.

> A failure occurred while executing org.ysb33r.grolifant.internal.v6.jvm.worker.InternalWorkerAppExecutor
   > org.jruby.exceptions.LoadError: (LoadError) no such file to load -- asciidoctor-mathematical

With the new asciidoctorj engine, it is not always necessary to supply a requires statement and doing so can cause issues.
Try removing the asciidoctorj.requires entry and see if it runs.
It it does not, I'll craft a test with asciidoctor-mathematical to see if I can reproduce the issue.

@diguage
Copy link

diguage commented Feb 8, 2024

I met a similar problem: it could not download gem. I submitted to #684 (comment)

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

No branches or pull requests

3 participants