Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve jextract error reporting#40

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

@JornVernee
Copy link
Member

@JornVerneeJornVernee commentedMar 5, 2020
edited by openjdkbot
Loading

Hi,

I spent the last couple of days tracking down a crash I was seeing sometimes when running jextract. In the process I ended up doing several improvements to jextract's error checking and reporting, that I think are useful to keep in the long run.

The changes include:

  • Usingclang_parseTranslationUnit2 to parse, since that returns an error code, instead of a null translation unit. This also means we can still process diagnostic for the returned translation unit (now returned in a buffer).
  • Checking the return codes forclang_parseTranslationUnit2,clang_saveTranslationUnit, andclang_reparseTranslationUnit (using a proper enum) and throwing an exception in case they are erroneous.
  • Catching BadMacroException instead of Throwable in the macro parser. We only care about the former, and catching Throwable could lead to too many exceptions being eaten. Technically, if there is an unknown exception, we could just skip the macro, but this isn't always the right strategy. For example, when re-parsing fails the used translation unit becomes invalid, so we really need to do something else than just skipping the macro in that case (to be addressed in another patchhttps://bugs.openjdk.java.net/browse/JDK-8240614). Imo it's better to just crash than to skip when we encounter an unknwon exception, so that we're more likely to find issues.
  • Enabling libclang crash recovery by default. By default the crash recovery was being disabled. This leads to the process exiting with OS exception code. If we enable this however, it will instead try to return an error code from the libclang call, which we can then check for and handle the failure however we want.

Thanks,
Jorn


Progress

  • Change must not contain extraneous whitespace
  • Change must be properly reviewed

Reviewers

  • Athijegannathan Sundararajan (sundar - Committer)

Download

$ git fetch https://git.openjdk.java.net/panama-foreign pull/40/head:pull/40
$ git checkout pull/40

@bridgekeeper
Copy link

👋 Welcome back jvernee! A progress list of the required criteria for merging this PR intoforeign-jextract will be added to the body of your pull request.

@openjdkopenjdkbot added the rfrReady for review labelMar 5, 2020
@mlbridge
Copy link

mlbridgebot commentedMar 5, 2020
edited
Loading

Webrevs

.collect(toMap(SaveError::code,Function.identity()));

publicstaticSaveErrorvalueOf(intcode) {
returnlookup.computeIfAbsent(code,k -> {thrownewNoSuchElementException("No SaveError with code: " +k); });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Do we need this computeIfAbsent with lambda? All we do is to throw exception always if key is not found.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Map doesn't have agetOrThrow, butcomputeIfAbsent effectively works the same way. The alternative would beget plus null check.

@openjdk
Copy link

openjdkbot commentedMar 5, 2020
edited
Loading

@JornVernee This change now passes all automated pre-integration checks. When the change also fulfills allproject specific requirements, type/integrate in a new comment to proceed. After integration, the commit message will be:

Improve jextract error reportingReviewed-by: sundar
  • If you would like to add a summary, use the/summary command.
  • To credit additional contributors, use the/contributor command.
  • To add additional solved issues, use the/solves command.

Since the source branch of this PR was last updated there have been 91 commits pushed to theforeign-jextract branch. Since there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please mergeforeign-jextract into your branch, and then specify the current head hash when integrating, like this:/integrate a03a4c5b2c2d7402ab5db88b6b28d2573fec913b.

➡️ To integrate this PR with the above commit message, type/integrate in a new comment.

@openjdkopenjdkbot added the readyReady to be integrated labelMar 5, 2020
@JornVernee
Copy link
MemberAuthor

Wrt the crash recovery; It seems to work reliably on Windows, so I think we should at least turn it on there, since the alternative is having a jextract that crashes quite frequently on Windows (maybe 1 in 5 runs, depending on the header contents).

Copy link
Collaborator

@slowhogslowhog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good, my only concern is the disable clang crash recovery default was disabled but now default to enable.

The past experience is that crash recovery cause JVM crash from time to time, so unless we are certain that situation changes and should be default to enable, perhaps we should just default to disable as before.

sundararajana reacted with thumbs up emoji
@sundararajana
Copy link
Member

Looks good, my only concern is the disable clang crash recovery default was disabled but now default to enable.

The past experience is that crash recovery cause JVM crash from time to time, so unless we are certain that situation changes and should be default to enable, perhaps we should just default to disable as before.

I agree with Henry. It's better to restore the default but make it configurable via system property. Having different defaults on different platforms would be confusing to the user. Because it is configurable, we can try the config for debugging on any platform.

@JornVernee
Copy link
MemberAuthor

I've uploaded another revision where I've change the default of crash recovery back to disabled, but kept the property.

Copy link
Member

@sundararajanasundararajana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good!

@JornVernee
Copy link
MemberAuthor

/integrate

@openjdkopenjdkbot closed thisMar 6, 2020
@openjdkopenjdkbot added integratedPull request has been integrated and removed readyReady to be integrated rfrReady for review labelsMar 6, 2020
@openjdk
Copy link

openjdkbot commentedMar 6, 2020

@JornVernee The following commits have been pushed to foreign-jextract since your change was applied:

  • e64f28e: Automatic merge of foreign-abi into foreign-jextract
  • ff700a4: Automatic merge of foreign-memaccess into foreign-abi
  • 5153187: Automatic merge of master into foreign-memaccess
  • 05b8f97: Automatic merge of jdk:master into master
  • 25d2db0: 8240589: OtherRegionsTable::_num_occupied not updated correctly
  • 3adad5a: 8239856: [ntintel] asserts about copying unaligned array element
  • f10fd7a: 8240603: Windows 32bit compile error after 8238676
  • 9c6a769: 8153430: jdk regression test MletParserLocaleTest, ParserInfiniteLoopTest reduce default timeout
  • f456f15: 8240538: [JVMCI] add test for JVMCI ConstantPool class
  • 001b805: 8240624: Note mapping of RoundingMode constants to equivalent IEEE 754-2019 attribute
  • 4a32eda: 8240454: incorrect error message: as of release 13, 'record' is a restricted type name
  • 3607ddd: 8211917: Zip FS should add META-INF/MANIFEST.FS at the start of the Zip/JAR
  • db91be2: 8240241: Add support for JCov DiffCoverage to make files
  • d75e62e: 8239376: JFR: assert(!cld->is_unsafe_anonymous()) failed: invariant
  • 78982f7: 8240528: OopMap cleanup
  • 3ddd7b8: 8240370: Provide Intel JCC Erratum opt-out
  • 3490262: 8240197: Cannot start JVM when $JAVA_HOME includes CJK characters
  • b2f1f73: 8183369: RFC unconformity of HttpURLConnection with proxy
  • d181894: 8240286: [TESTBUG] Test command error in hotspot/jtreg/compiler/loopopts/superword/SumRedAbsNeg_Float.java
  • 7ba18fc: 8240244: Avoid calling resolve_super_or_fail in SystemDictionary::load_shared_class
  • 6cb2e02: 8240546: runtime/cds/appcds/TestZGCWithCDS.java fails with Graal
  • 10b09c7: Added tag jdk-15+13 for changeset 1c06a8ee8aca
  • 5229896: 8240481: Remove CDS usage of InstanceKlass::is_in_error_state
  • edb59b5: 8239817: Eliminate use of contentContainer and friends
  • 01ef6d7: 8240534: Shenandoah: ditch debug safepoint timeout adjustment
  • ff843fa: 8240333: jmod incorrectly updates .jar and .jmod files during hashing
  • 128f083: 8238692: MacOS runtime Installer issue
  • ef4053e: 8237966: Creating runtime pkg requires --mac-package-identifier
  • aa54795: 8237967: No proper error message when --runtime-image points to non-existent path
  • e44dcf0: 8234896: Tab completion does not work for method references in jshell
  • 0c99838: 8228451: NPE in Attr.java when -XDshould-stop.ifError=FLOW
  • 9d57eef: 8239575: javadoc triggers javac AssertionError for annos on modules
  • b3666b9: 8240511: Shenandoah: parallel safepoint workers count should be ParallelGCThreads
  • 8e74ed4: 8239787: AArch64: String.indexOf may incorrectly handle empty strings
  • 86ad195: 8238384: CTW: C2 compilation fails with "assert(store != load->find_exact_control(load->in(0))) failed: dependence cycle found"
  • 1e796ea: 8239367: RunThese30M.java failed due to "assert(false) failed: graph should be schedulable"
  • 89448a8: 8233619: SSLEngine handshake status immediately after the handshake can be NOT_HANDSHAKING rather than FINISHED with TLSv1.3
  • 467ee78: 8235206: JFR TestCrossProcessStreaming - validate that data can be consumed while it is being produced
  • ea55699: 8239055: Wrong implementation of VMState.hasListener
  • 3ca275f: 8225760: oop::raw_set_obj isn't needed
  • cf89ff7: 8240324: Improve is_boot_class_loader_data() by adding simple check
  • 52cfd29: 8240263: Assertion-only call in Method::link_method affecting product builds
  • 3fdf26d: 8240302: x64: Assembler::reachable redundantly call Relocation::type() more than once
  • 2a79146: 8240235: jdk.test.lib.util.JarUtils updates jar files incorrectly
  • 908a933: 8238759: Clones should always keep the base pointer
  • 26a7b0d: Merge
  • c42de93: 8238676: jni crashes on accessing it from process exit hook
  • 35ee1cb: 8236938: [TESTBUG] JFR event MetaspaceAllocationFailure is not tested
  • 96b61b8: 8240246: Avoid cast_to_oop from char*
  • c280d98: 8237766: Enhance signature API to include ResolvingSignatureStream
  • e455d38: 8234812: Add micros for DatagramChannel send/receive
  • 6bb0536: 8239568: [TESTBUG] LoadLibraryTest.java fails with RuntimeException
  • 84f3e86: 8238555: Allow Initialization of SunPKCS11 with NSS when there are external FIPS modules in the NSSDB
  • 1491340: 8240223: Use consistent predicate order in and with PhaseIdealLoop::find_predicate
  • ac60e4b: 8240220: IdealLoopTree::dump_head predicate printing is broken
  • d7b122e: 8238438: SuperWord::co_locate_pack picks memory state of first instead of last load
  • ebadfae: 8196334: Optimize UUID#fromString
  • 751de03: 8225130: Add exception for expiring Comodo roots to VerifyCACerts test
  • 65bf618: Merge
  • 0532bd2: 8240267: VM fails to start with CDS enabled but JVMTI disabled
  • 742bdf0: 8239915: Zero VM crashes when handling dynamic constant
  • 0a820d6: 8239916: SA: delete dead code in jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java
  • 5bfb814: 8240258: SystemDictionary::quick_resolve need guarded by INCLUDE_CDS
  • f176fae: 8240254: Build is broken when cds is disabled after JDK-8236604
  • add146c: 8236604: Optimize SystemDictionary::resolve_well_known_classes for CDS
  • b247e6d: 8203239: [TESTBUG] remove vmTestbase/vm/gc/kind/parOld test
  • 1be89d9: 8240136: Cleanup/simplify HTML/CSS for definition lists
  • b38f3cf: 8240226: DeflateIn_InflateOut.java test incorrectly assumes size of compressed file
  • 8a79f26: 8240217: Shenandoah: remove ShenandoahEvacAssist
  • 6ad1db4: 8240216: Shenandoah: remove ShenandoahTerminationTrace
  • 5afeeed: 8240215: Shenandoah: remove ShenandoahAllocationTrace
  • 637795e: 8239931: [win][x86] vtable stub generation: assert failure (code size estimate) follow-up
  • 0cd6d13: 8240231: Build failure on illumos after 8238988
  • bd25c0e: 8239852: java/util/concurrent tests fail with -XX:+VerifyGraphEdges: assert(!VerifyGraphEdges) failed: verification should have failed
  • 5e912fb: 8240202: A few client tests leave mouse buttons pressed
  • 55768aa: 8239583: [AIX] simplify the native references in X input methods
  • fa7f53e: 8235147: Release HDC from passiveDCList sooner
  • f916df3: 8238985: [TESTBUG] The arrow image is blue instead of green
  • b5e1622: 8153090: TAB key cannot change input focus after the radio button in the Color Selection dialog
  • b5fdcb0: 8216329: Cannot resize CheckBoxItemMenu in Synth L&F with setHorizontalTextPosition
  • 3c72042: 8239334: Tab Size does not work correctly in JTextArea with setLineWrap on
  • c6e9d20: 8237221: [macos] java/awt/MenuBar/SeparatorsNavigation/SeparatorsNavigation.java fails
  • 80f5a47: 8239091: Reversed arguments in call to strstr in freetype "debug" code
  • e6915ff: 8238942: Rendering artifacts with LCD text and fractional metrics
  • 5705a55: 8233827: Enable screenshots in the enhanced failure handler on Linux/macOS
  • 784e575: 8238741: java.awt.Robot(GraphicsDevice) constructor does not follow the spec
  • 8d2aa62: 8221823: Requested JDialog width is ignored
  • 7af366a: 8238738: AudioSystem.getMixerInfo() takes about 30 sec to report a gone audio device
  • ff55c49: 8238842: AIOOBE in GIFImageReader.initializeStringTable
  • 5cf8520: 8240602: port more tests from old jextract tests

Your commit was automatically rebased without conflicts.

Pushed as commita03a4c5.

@mlbridge
Copy link

mlbridgebot commentedMar 6, 2020

Mailing list message fromJorn Vernee onpanama-dev:

Changeset:a03a4c5
Author: Jorn Vernee <jvernee at openjdk.org>
Date: 2020-03-06 11:37:40 +0000
URL: https://git.openjdk.java.net/panama-foreign/commit/a03a4c5b

Improve jextract error reporting

Reviewed-by: sundar

+ src/jdk.incubator.jextract/share/classes/jdk/internal/clang/ErrorCode.java
! src/jdk.incubator.jextract/share/classes/jdk/internal/clang/Index.java
! src/jdk.incubator.jextract/share/classes/jdk/internal/clang/LibClang.java
+ src/jdk.incubator.jextract/share/classes/jdk/internal/clang/SaveError.java
! src/jdk.incubator.jextract/share/classes/jdk/internal/clang/TranslationUnit.java
! src/jdk.incubator.jextract/share/classes/jdk/internal/jextract/impl/MacroParserImpl.java

@mcimadamoremcimadamore mentioned this pull requestMar 23, 2020
2 tasks
@JornVerneeJornVernee deleted the ErrorCode branchMarch 26, 2020 10:19
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

2 more reviewers

@slowhogslowhogslowhog left review comments

@sundararajanasundararajanasundararajana approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

integratedPull request has been integrated

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@JornVernee@sundararajana@slowhog

[8]ページ先頭

©2009-2025 Movatter.jp