-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!B-devtoolsIncludes everything BiDi or Chrome DevTools relatedIncludes everything BiDi or Chrome DevTools relatedC-javaJava BindingsJava BindingsI-defectSomething is not working as intendedSomething is not working as intended
Description
What happened?
For CDP session HeapProfiler.addHeapSnapshotChunk() event, Selenium is not returning the large chunk data in sequence and there is not way to place the returned data in order without low level access.
How can we reproduce the issue?
DevTools devTools = ((HasDevTools) driver).getDevTools();
devTools.createSession();
devTools.send(HeapProfiler.enable());
Queue<String> queue = new LinkedList<>();
devTools.addListener(HeapProfiler.addHeapSnapshotChunk(), queue::add);
devTools.send(HeapProfiler.takeHeapSnapshot(Optional.of(false), Optional.of(false), Optional.of(false), Optional.of(false)));
try {
FileOutputStream fileOutputStream = new FileOutputStream("/tmp/output.heapsnapshot");
while (!queue.isEmpty()) {
fileOutputStream.write(queue.poll().getBytes());
}
} catch (IOException e) {
throw new RuntimeException(e);
}
devTools.clearListeners();
devTools.close();
Another way to reproduce is to print the string size every time the event is fired.
final ReentrantLock lock = new ReentrantLock(true);
devTools.addListener(HeapProfiler.addHeapSnapshotChunk(), target -> {
lock.lock();
System.out.println(target.length());
lock.unlock();
});
And you would still see the output end up like:
102400
102400
102400
102400
102400
32441
102400
102400
102400
102400
Relevant log output
Usually the log output will start with {"snapshot":{"meta":{"node_fields": but not always.
The log output should be a complete json file but you would often see the file ends with broken output.
Each large chunk data's length is 102400.
Operating System
maci and windows
Selenium version
open jdk 21.0.2
What are the browser(s) and version(s) where you see this issue?
Chrome 118
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 118
Are you using Selenium Grid?
No response
Metadata
Metadata
Assignees
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!B-devtoolsIncludes everything BiDi or Chrome DevTools relatedIncludes everything BiDi or Chrome DevTools relatedC-javaJava BindingsJava BindingsI-defectSomething is not working as intendedSomething is not working as intended