Graalvm Isolate thread blocking
geek29 opened this issue · 1 comments
geek29 commented
I am trying out native-netty-plot demo which is about running java code in native-image isolates. I made some changes in the demo after which example is blocking. HTTP Client making requests to netty server is blocking waiting for response. On further investigation, I found out code is blocking on Isolates.tearDownIsolate(renderingContext);
call.
Below is the original code which I modified - mainly using logger library logback and making network call using Apach Http clients. I would like to know under what circumstances tearDownIsolate call will block? and How to investigate it further.
@CEntryPoint
private static ObjectHandle plotAsSVG(@CEntryPoint.IsolateThreadContext IsolateThread renderingContext, IsolateThread nettyContext, ObjectHandle functionHandle, double xmin, double xmax) {
//long initialMemory = printMemoryUsage("Rendering isolate initial memory usage: ", 0);
/ * Resolve and delete the functionHandle, now that execution is in the rendering isolate. * /
String function = ObjectHandles.getGlobal().get(functionHandle);
ObjectHandles.getGlobal().destroy(functionHandle);
//byte[] svgBytes = ImageSingletons.lookup(Graphics2DPlotter.class).plotAsSVG(function, xmin, xmax);
byte[] svgBytes = ImageSingletons.lookup(XYZRunner.class).run(function, xmin, xmax);
ObjectHandle byteBufferHandle;
try (PinnedObject pin = PinnedObject.create(svgBytes)) {
byteBufferHandle = createByteBuffer(nettyContext, pin.addressOfArrayElement(0), svgBytes.length);
}
//printMemoryUsage("Rendering isolate final memory usage: ", initialMemory);
return byteBufferHandle;
}
geek29 commented
Network connection being open caused isolate teardown block. Closing this issue.