`ActiveSessionException` in TestNG integration suggests conflict with parallel execution

Đang mở
#305 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
testing-qa

Hướng nghiên cứu

Bắt đầu với com.appland.appmap.process.hooks.test.TestNG.testng và đường dẫn Recorder.start được hiển thị trong stack trace, sau đó kiểm tra RecordingSupport.startRecording và TestSupport.startRecording. Tái hiện lỗi với TestNG parallel="methods" hoặc parallel="tests" và xác định xem có thể cô lập các session theo từng thread hay phải vô hiệu hóa tính song song. Được xem là hoàn tất khi việc thực thi song song không còn gây ra ActiveSessionException và các bản ghi vẫn hoàn tất.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

A user running TestNG tests with the appmap-java agent is encountering an ActiveSessionException, which causes the recording to fail. We suspect this is due to TestNG's parallel execution feature, which the AppMap agent's Recorder may not currently support.

When multiple tests run concurrently, each test thread appears to trigger the AppMap TestNG hook (com.appland.appmap.process.hooks.test.TestNG.testng) and attempts to call startRecording. The first test succeeds, but subsequent concurrent tests fail when the Recorder detects that a session is already active, throwing the exception.

Error Log & Stack Trace

The key error message from the user's log is:

AppMap agent version 1.28.0 starting
[TestNG] Running:
  <path-to-project>\src\test\resources\testsuite\testing.xml
...
17:08:07.398 [main] WARN RecordingSupport.startRecording: com.appland.appmap.record.ActiveSessionException: an active recording session already exists
    at com.appland.appmap.record.Recorder$ActiveSession.set(Recorder.java:162)
    at com.appland.appmap.record.Recorder.start(Recorder.java:241)
    at com.appland.appmap.process.hooks.RecordingSupport.startRecording(RecordingSupport.java:59)
    at com.appland.appmap.process.hooks.test.TestSupport.startRecording(TestSupport.java:63)
    at com.appland.appmap.process.hooks.test.TestSupport.startRecording(TestSupport.java:25)
    at com.appland.appmap.process.hooks.test.TestNG.testng(TestNG.java:45)
Requested Action
  1. Investigate: Please confirm if appmap-java's TestNG support is compatible with parallel test execution (e.g., parallel="methods" or parallel="tests" in the testng.xml suite).
  2. Remediate:
    • Ideally: If possible, update the agent to properly support parallel TestNG execution, perhaps by managing recording sessions on a per-thread basis.
    • Alternatively: If parallel support is not feasible or as an interim solution, please add logic to detect when TestNG parallelism is enabled and automatically disable it (force serial execution) when the AppMap agent is attached. This would prevent the crash and allow users to generate AppMaps, albeit with a slower test run.
Full Terminal Output (for context)
"<path-to-java>\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 -Dappmap.config.file=<path-to-project>\appmap.yml -javaagent:<user-home>\.appmap\lib\java\appmap.jar "-javaagent:<path-to-ide>\lib\idea_rt.jar=56911" -javaagent:<user-home>\AppData\Local\JetBrains\IdeaIC\captureAgent\debugger-agent.jar -Dkotlinx.coroutines.debug.enable.creation.stack.trace=false -Ddebugger.agent.enable.coroutines=true
 -Dkotlinx.coroutines.debug.enable.flows.stack.trace=true -Dkotlinx.coroutines.debug.enable.mutable.state.flows.stack.trace=true -Dfile.encoding=UTF-8 @<temp-path>\idea_arg_file1573352798 com.intellij.rt.testng.RemoteTestNGStarter -usedefaultlisteners
 false -socket56910 @w@<temp-path>\idea_working_dirs_testng2.tmp -temp <temp-path>\idea_testng2.tmp

AppMap agent version 1.28.0 starting

[TestNG] Running:

  <path-to-project>\src\test\resources\testsuite\testing.xml
Java HotSpot(TM) 64-Bit Server VM warning: Sharing 
is only supported for boot loader classes because bootstrap classpath 
has been appended

SLF4J(W): No SLF4J providers were found.
.. 
17:08:07.398 [main] WARN RecordingSupport.startRecording: com.appland.appmap.record.ActiveSessionException: an active recording session already exists

    at com.appland.appmap.record.Recorder$ActiveSession.set(Recorder.java:162)

    at com.appland.appmap.record.Recorder.start(Recorder.java:241)

    at com.appland.appmap.process.hooks.RecordingSupport.startRecording(RecordingSupport.java:59)

    at com.appland.appmap.process.hooks.test.TestSupport.startRecording(TestSupport.java:63)

    at com.appland.appmap.process.hooks.test.TestSupport.startRecording(TestSupport.java:25)

    at com.appland.appmap.process.hooks.test.TestNG.testng(TestNG.java:45)
Ngôn ngữ chính
Java
Star
88
Fork
17
Merge trung bình
2 ngày 2 giờ
Pull request đã merge (30 ngày)
1

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của getappmap/appmap-java

Tất cả issue của getappmap/appmap-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.