oracle / graalpython

A Python 3 implementation built on GraalVM
Other
1.2k stars 104 forks source link

com.oracle.truffle.api.dsl.UnsupportedSpecializationException: Unexpected values provided for BaseExceptionBuiltinsFactory.StrNodeFactory.StrNodeGen@6cba95cc: [com.oracle.truffle.llvm.runtime.except.LLVMPolyglotException: Invalid argument to polyglot builtin.], [LLVMPolyglotException] #302

Closed oroppas closed 1 year ago

oroppas commented 1 year ago

I've got this truffle exception while dealing with GraalPy, so let me first report it here. Please let me know if there is a better place to report.

Let's assume venv is already activated for GraalPy. In order to replicate the error, Cython needs to be installed by

graalpy -m pip install Cython

as Cython is required by lxml

Then follow the steps below:

git clone https://github.com/lxml/lxml
cd lxml
make
make test

Here's the detailed log:

(graalpy) [ryuta@fedora lxml]$ make test
python setup.py  build_ext -i  --with-cython --warnings  -j7
Building lxml version 4.9.2.
Building with Cython 0.29.32.
Building against libxml2 2.10.3 and libxslt 1.1.37
running build_ext
copying build/lib.linux-x86_64-3.10/lxml/etree.graalpy230-310-native-x86_64-linux.so -> src/lxml
copying build/lib.linux-x86_64-3.10/lxml/objectify.graalpy230-310-native-x86_64-linux.so -> src/lxml
python test.py -p -v  
Skipping tests in lxml.cssselect - external cssselect package is not installed
Comparing with ElementTree 1.3.0

TESTED VERSION: 4.9.2
    Python:           sys.version_info(major=3, minor=10, micro=8, releaselevel='alpha', serial=0)
    lxml.etree:       (4, 9, 2, 0)
    libxml used:      (2, 10, 3)
    libxml compiled:  (2, 10, 3)
    libxslt used:     (1, 1, 37)
    libxslt compiled: (1, 1, 37)
    FS encoding:      utf-8
    Default encoding: UTF-8
    Max Unicode:      1114111

   1/1959 (  0.1%): txt (test_autolink)
   2/1959 (  0.1%): txt (test_basic)
   3/1959 (  0.2%): Classes (lxml.html)
   4/1959 (  0.2%): drop_tag (...mlMixin)
   5/1959 (  0.3%): XHTMLParser (lxml.html)
   6/1959 (  0.3%): tostring (lxml.html)
   9/1959 (  0.5%): txt (test_clean)ins (...tests.test_basic.TestBasicFeatures)
  10/1959 (  0.5%): txt (test_clean_embed)
  27/1959 (  1.4%): txt (test_diff)inks (....html.tests.test_clean.CleanerTest)
  28/1959 (  1.4%): html_annotate (...ff)  
  74/1959 (  3.8%): txt (test_formfill)ts/hackers-org-data/xml-embedded-js.data
  75/1959 (  3.8%): txt (test_forms)   
 117/1959 (  6.0%): txt (test_rewritelinks)l.tests.test_html5parser.Test_parse)
 123/1959 (  6.3%): txt (test_xhtml)ct_value_no_selected_option (...SelectTest)
 128/1959 (  6.5%): test_qname_tag (lxml.tests.test_builder.BuilderTestCase)   Traceback (most recent call last):
  File "/home/ryuta/packages/graalvm/python/lxml/lxml/test.py", line 577, in main
  File "/home/ryuta/packages/graalvm/graalvm/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib/python3.10/unittest/suite.py", line 122, in run
  File "/home/ryuta/packages/graalvm/graalvm/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib/python3.10/unittest/case.py", line 650, in __call__
  File "/home/ryuta/packages/graalvm/graalvm/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib/python3.10/unittest/case.py", line 599, in run
  File "/home/ryuta/packages/graalvm/graalvm/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib/python3.10/unittest/case.py", line 518, in _feedErrorsToResult
  File "/home/ryuta/packages/graalvm/graalvm/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib/python3.10/traceback.py", line 508, in __init__
  File "/home/ryuta/packages/graalvm/graalvm/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib/python3.10/traceback.py", line 171, in _some_str
Unexpected values provided for BaseExceptionBuiltinsFactory.StrNodeFactory.StrNodeGen@6cba95cc: [com.oracle.truffle.llvm.runtime.except.LLVMPolyglotException: Invalid argument to polyglot builtin.], [LLVMPolyglotException]
Traceback (most recent call last):
  File "/home/ryuta/packages/graalvm/python/lxml/lxml/test.py", line 577, in main
  File "/home/ryuta/packages/graalvm/graalvm/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib/python3.10/unittest/suite.py", line 122, in run
  File "/home/ryuta/packages/graalvm/graalvm/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib/python3.10/unittest/case.py", line 650, in __call__
  File "/home/ryuta/packages/graalvm/graalvm/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib/python3.10/unittest/case.py", line 599, in run
  File "/home/ryuta/packages/graalvm/graalvm/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib/python3.10/unittest/case.py", line 518, in _feedErrorsToResult
  File "/home/ryuta/packages/graalvm/graalvm/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib/python3.10/traceback.py", line 508, in __init__
  File "/home/ryuta/packages/graalvm/graalvm/graal/sdk/mxbuild/linux-amd64/GRAALVM_3666026860_JAVA17/graalvm-3666026860-java17-23.0.0-dev/languages/python/lib/python3.10/traceback.py", line 171, in _some_str
Unexpected values provided for BaseExceptionBuiltinsFactory.StrNodeFactory.StrNodeGen@6cba95cc: [com.oracle.truffle.llvm.runtime.except.LLVMPolyglotException: Invalid argument to polyglot builtin.], [LLVMPolyglotException]
Traceback (most recent call last):
  File "test.py", line 450, in main
  File "<module>", line 102, in run
  File "<module>", line 649, in __call__
  File "<module>", line 557, in run
  File "<module>", line 510, in _feedErrorsToResult
  File "<module>", line 489, in __init__
  File "<module>", line 169, in _some_str
com.oracle.truffle.api.dsl.UnsupportedSpecializationException: Unexpected values provided for BaseExceptionBuiltinsFactory.StrNodeFactory.StrNodeGen@6cba95cc: [com.oracle.truffle.llvm.runtime.except.LLVMPolyglotException: Invalid argument to polyglot builtin.], [LLVMPolyglotException]
make: *** [Makefile:92: test_inplace] Error 1
msimacek commented 1 year ago

The UnsupportedSpecializationException is currently just a secondary symptom of Sulong (the LLVM runtime) crashes. The real cause is Invalid argument to polyglot builtin part. I've already encountered the same issue (I was also testing lxml) few weeks ago and reported it to Sulong team (it's an issue on their end).

msimacek commented 1 year ago

I just merged several fixes for lxml and now the tests shouldn't crash anymore (some tests still fail, but there should be no more hard crashes).

oroppas commented 1 year ago

Awesome. Thanks!