swiftlang / swiftlang/swift-java

Downcalls to witness table (e.g. destroy) hang on Linux x86_64

Open
#97 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug feature:jextract
Dominant language
Swift
Stars
1.2k
Forks
123
Avg merge
1d 7h
Merged PRs (30d)
16

Description

See also the disabled test for this:

    // FIXME: The destroy witness table call hangs on x86_64 platforms during the destroy witness table call
    @Test
    @DisabledIf("isAmd64")
    public void arena_releaseClassOnClose_class_ok() {

I didn't check on intel mac yet, so it could be either an linux issue or an x86_64 issue.
This manifests as just "hanging" when we do the downcall:


"Test worker" #1 [18055] prio=5 os_prio=0 cpu=437570.63ms elapsed=437.65s tid=0x00007f263c02bbe0 nid=18055 runnable  [0x00007f2643b86000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.invoke.LambdaForm$MH/0x00007f25c31e6400.invoke(java.base@22.0.2/LambdaForm$MH)
        at java.lang.invoke.LambdaForm$MH/0x00007f25c31e8800.invokeExact_MT(java.base@22.0.2/LambdaForm$MH)
        at jdk.internal.foreign.abi.DowncallStub/0x00007f25c31e6800.invoke(java.base@22.0.2/Unknown Source)
        at java.lang.invoke.LambdaForm$DMH/0x00007f25c31e6c00.invokeStaticInit(java.base@22.0.2/LambdaForm$DMH)
        at java.lang.invoke.LambdaForm$MH/0x00007f25c31e7c00.invoke(java.base@22.0.2/LambdaForm$MH)
        at java.lang.invoke.LambdaForm$MH/0x00007f25c31e8000.invokeExact_MT(java.base@22.0.2/LambdaForm$MH)
        at org.swift.swiftkit.SwiftValueWitnessTable.destroy(SwiftValueWitnessTable.java:221)
        at org.swift.swiftkit.SwiftHeapObjectCleanup.run(SwiftMemoryResourceCleanup.java:37)
        at org.swift.swiftkit.ConfinedSwiftMemorySession$ConfinedResourceList.cleanup(SwiftArena.java:140)
        at org.swift.swiftkit.ConfinedSwiftMemorySession.close(SwiftArena.java:104)
        at org.swift.swiftkit.SwiftArenaTest.arena_releaseClassOnClose_class_ok(SwiftArenaTest.java:50)

It readily reproduces in such docker container as well:

docker build --platform linux/amd64 --tag swift-java-x86_64 docker
docker run --rm -v$(pwd):/code -it --platform linux/amd64 swift-java-x86_64 /bin/bash

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the disabled arena_releaseClassOnClose_class_ok test in SwiftArenaTest.java and the downcall entry point in SwiftValueWitnessTable.java. Reproduce the hang using the provided linux/amd64 Docker commands, then compare the stack trace and platform behavior. Done means the destroy witness-table downcall no longer hangs on Linux x86_64 and the test can be evaluated without the workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java, linux, swift
Domain
devtools, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.