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

Not compatible to the expected encoding "BYTES" #2770

Closed
djberg96 opened this issue Nov 7, 2022 · 1 comment
Closed

Not compatible to the expected encoding "BYTES" #2770

djberg96 opened this issue Nov 7, 2022 · 1 comment
Assignees
Labels

Comments

@djberg96
Copy link
Contributor

djberg96 commented Nov 7, 2022

truffleruby 22.3.0, like ruby 3.0.3, GraalVM CE Native [x86_64-darwin]

Just experimenting with truffleruby and a Ruby PDF library called hexapdf, I was hoping to do a speed comparison. However, just to make sure that it worked as expected, I tried running the hexapdf test suite and ran into this. Any ideas?

>bundle exec rake
hexapdf.gemspec:3: warning: already initialized constant PKG_FILES
/Users/dberger/Dev/hexapdf/hexapdf.gemspec:3: warning: previous definition of PKG_FILES was here
Run options: --seed 54313

# Running:

.................................................................S......................................................................................................................................................F.............................................................................................................................................................................................................................................................................................................................................................................F.................................................................SSSS.SSSSSS.S...SSSSSS.S..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
truffleruby: Unexpected internal exception in at_exit,
please report it to https://github.com/oracle/truffleruby/issues.

the given string is not compatible to the expected encoding "BYTES", did you forget to convert it? (java.lang.IllegalArgumentException)
	from com.oracle.truffle.api.strings.InternalErrors.wrongEncoding(InternalErrors.java:91)
	from com.oracle.truffle.api.strings.AbstractTruffleString.looseCheckEncoding(AbstractTruffleString.java:354)
	from com.oracle.truffle.api.strings.TruffleString$ConcatNode.doConcat(TruffleString.java:4550)
	from com.oracle.truffle.api.strings.TruffleStringFactory$ConcatNodeGen.executeAndSpecialize(TruffleStringFactory.java:4492)
	from com.oracle.truffle.api.strings.TruffleStringFactory$ConcatNodeGen.execute(TruffleStringFactory.java:4420)
	from org.truffleruby.core.string.StringNodes$StringSplicePrimitiveNode.splicePrepend(StringNodes.java:4039)
	from org.truffleruby.core.string.StringNodesFactory$StringSplicePrimitiveNodeFactory$StringSplicePrimitiveNodeGen.executeAndSpecialize(StringNodesFactory.java:13356)
	from org.truffleruby.core.string.StringNodesFactory$StringSplicePrimitiveNodeFactory$StringSplicePrimitiveNodeGen.execute(StringNodesFactory.java:13328)
	from org.truffleruby.language.RubyNodeWrapper.execute(RubyNodeWrapper.java:45)
	from org.truffleruby.language.RubyNode.doExecuteVoid(RubyNode.java:63)
	from org.truffleruby.language.control.SequenceNode.execute(SequenceNode.java:34)
	from org.truffleruby.language.control.IfElseNode.execute(IfElseNode.java:45)
	from org.truffleruby.language.control.IfElseNode.execute(IfElseNode.java:45)
	from org.truffleruby.language.RubyNode.doExecuteVoid(RubyNode.java:63)
	from org.truffleruby.language.control.SequenceNode.execute(SequenceNode.java:34)
	from org.truffleruby.language.control.IfElseNode.execute(IfElseNode.java:45)
	from org.truffleruby.language.control.SequenceNode.execute(SequenceNode.java:37)
	from org.truffleruby.language.RubyMethodRootNode.execute(RubyMethodRootNode.java:65)
/Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/truffle/stringio.rb:268:in 'write'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/truffle/stringio.rb:76:in '<<'
	from /Users/dberger/Dev/hexapdf/lib/hexapdf/writer.rb:126:in 'write_file_header'
	from /Users/dberger/Dev/hexapdf/lib/hexapdf/writer.rb:79:in 'write'
	from /Users/dberger/Dev/hexapdf/test/hexapdf/test_writer.rb:155:in 'test_0002_moves modified objects into the last revision'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest/test.rb:98:in 'block (3 levels) in run'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest/test.rb:195:in 'capture_exceptions'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest/test.rb:95:in 'block (2 levels) in run'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:296:in 'time_it'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest/test.rb:94:in 'block in run'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:391:in 'on_signal'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest/test.rb:243:in 'with_info_handler'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest/test.rb:93:in 'run'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:1059:in 'run_one_method'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:365:in 'run_one_method'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:352:in 'block (2 levels) in run'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:351:in 'each'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:351:in 'block in run'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:391:in 'on_signal'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:378:in 'with_info_handler'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:350:in 'run'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:182:in 'block in __run'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:182:in 'map'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:182:in '__run'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:159:in 'run'
	from /Users/dberger/.rbenv/versions/truffleruby-22.3.0/lib/gems/gems/minitest-5.16.3/lib/minitest.rb:83:in 'block in autorun'
'''
Coverage report generated for Unit Tests to /Users/dberger/Dev/hexapdf/coverage. 11167 / 12275 LOC (90.97%) covered.
Line coverage (90.97%) is below the expected minimum coverage (100.00%).
SimpleCov failed with exit 2 due to a coverage related error
java.lang.RuntimeException: Ruby Fiber id=505 from /Users/dberger/Dev/hexapdf/lib/hexapdf/encryption/arc4.rb:77 terminated with internal error:
	at org.truffleruby.core.thread.ThreadManager.printInternalError(ThreadManager.java:305)
	at org.truffleruby.core.thread.ThreadManager.lambda$uncaughtExceptionHandler$1(ThreadManager.java:178)
	at com.oracle.svm.core.thread.JavaThreads.dispatchUncaughtException(JavaThreads.java:222)
	at com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:777)
	at com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
Caused by: org.truffleruby.language.control.KillException: Thread#kill
Caused by: java.lang.RuntimeException
	at org.truffleruby.core.thread.ThreadManager$2.run(ThreadManager.java:666)
	at org.truffleruby.language.SafepointAction.perform(SafepointAction.java:78)
	at org.graalvm.truffle/com.oracle.truffle.api.LanguageAccessor$LanguageImpl.performTLAction(LanguageAccessor.java:551)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThreadLocalActions$AsyncEvent.acceptImpl(PolyglotThreadLocalActions.java:649)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThreadLocalActions$AbstractTLHandshake.accept(PolyglotThreadLocalActions.java:601)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThreadLocalActions$AbstractTLHandshake.accept(PolyglotThreadLocalActions.java:546)
	at org.graalvm.truffle/com.oracle.truffle.api.impl.ThreadLocalHandshake$Handshake.perform(ThreadLocalHandshake.java:219)
	at org.graalvm.truffle/com.oracle.truffle.api.impl.ThreadLocalHandshake$TruffleSafepointImpl.processHandshakes(ThreadLocalHandshake.java:368)
	at org.graalvm.truffle/com.oracle.truffle.api.impl.ThreadLocalHandshake.processHandshake(ThreadLocalHandshake.java:159)
	at com.oracle.svm.truffle.api.SubstrateThreadLocalHandshake.invokeProcessHandshake(SubstrateThreadLocalHandshake.java:127)
	at com.oracle.svm.truffle.api.SubstrateThreadLocalHandshake.poll(SubstrateThreadLocalHandshake.java:86)
	at org.graalvm.truffle/com.oracle.truffle.api.TruffleSafepoint.pollHere(TruffleSafepoint.java:184)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.enterThreadChanged(PolyglotContextImpl.java:913)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotEngineImpl.enterCached(PolyglotEngineImpl.java:2039)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotEngineImpl.enter(PolyglotEngineImpl.java:1986)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.EngineAccessor$EngineImpl.enterInternalContext(EngineAccessor.java:745)
	at org.graalvm.truffle/com.oracle.truffle.api.TruffleContext.enter(TruffleContext.java:190)
	at org.truffleruby.core.fiber.FiberManager.fiberMain(FiberManager.java:109)
	at org.truffleruby.core.fiber.FiberManager.lambda$initialize$0(FiberManager.java:69)
	at [email protected]/java.lang.Thread.run(Thread.java:833)
	at com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
	at com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
truffleruby: an exception escaped out of the interpreter - this is an implementation bug
Thread#kill
	at org.graalvm.sdk/org.graalvm.polyglot.Context.close(Context.java:857)
	at org.truffleruby.launcher.RubyLauncher.runContext(RubyLauncher.java:311)
	at org.truffleruby.launcher.RubyLauncher.runRubyMain(RubyLauncher.java:254)
	at org.truffleruby.launcher.RubyLauncher.launch(RubyLauncher.java:129)
	at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:296)
	at org.graalvm.launcher.AbstractLanguageLauncher.launch(AbstractLanguageLauncher.java:121)
	at org.graalvm.launcher.AbstractLanguageLauncher.runLauncher(AbstractLanguageLauncher.java:168)
rake aborted!
Command failed with status (1)
<internal:core> core/kernel.rb:376:in 'load'
<internal:core> core/kernel.rb:376:in 'load'
<internal:core> core/kernel.rb:376:in 'load'
<internal:core> core/kernel.rb:376:in 'load'
<internal:core> core/kernel.rb:376:in 'load'
<internal:core> core/kernel.rb:376:in 'load'
/Users/dberger/.rbenv/versions/truffleruby-22.3.0/bin/bundle:42:in '<main>'
Tasks: TOP => default => test
(See full trace by running task with --trace)
@eregon eregon added the bug label Nov 8, 2022
@eregon
Copy link
Member

eregon commented Nov 8, 2022

Thanks for the report. It means somewhere the encoding isn't passed correctly, probably in the core library.

@eregon eregon self-assigned this Nov 9, 2022
eregon added a commit to ruby/spec that referenced this issue Jan 5, 2023
…osition < buffer size

* Reuse StringIO#write for StringIO#putc to deduplicate logic.
* Retag TestStringIO.
* Fixes oracle/truffleruby#2770
john-heinnickel pushed a commit to thermofisher-jch/truffleruby that referenced this issue Aug 16, 2023
…osition < buffer size

* Reuse StringIO#write for StringIO#putc to deduplicate logic.
* Retag TestStringIO.
* Fixes oracle#2770
seven1m pushed a commit to seven1m/ruby_spec that referenced this issue Sep 2, 2023
…osition < buffer size

* Reuse StringIO#write for StringIO#putc to deduplicate logic.
* Retag TestStringIO.
* Fixes oracle/truffleruby#2770
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants