Aerospike Java异步库似乎陷入困境(Aerospike Java Async library seems stuck)
我正在使用aeropike异步客户端执行udf。 客户端已初始化为: -
try { asyncClientPolicy.maxThreads = 40; asyncClientPolicy.asyncMaxCommands = 20; asyncClientPolicy.maxSocketIdle = 13; asyncClientPolicy.asyncMaxCommandAction = MaxCommandAction.BLOCK; asyncClientPolicy.asyncSelectorThreads = 7; asyncClientPolicy.asyncTaskThreadPool = Executors.newFixedThreadPool(20, new ThreadFactory() { public final Thread newThread(Runnable runnable) { Thread thread = new Thread(runnable); thread.setDaemon(true); return thread; } }); }
所以我有20个线程来处理回调。 过了一会儿,我看到我的程序没有做任何进展,表明死锁/饥饿。 Jstack给了我以下结果: -
java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x000000064048f338> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043) at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:374) at com.aerospike.client.async.AsyncCluster$BlockBufferQueue.getByteBuffer(AsyncCluster.java:114) at com.aerospike.client.async.AsyncCluster.getByteBuffer(AsyncCluster.java:68) at com.aerospike.client.async.AsyncCommand.execute(AsyncCommand.java:59) at com.aerospike.client.async.AsyncClient.execute(AsyncClient.java:949) at main.java.labs.RuleEngineAerospikeConnection.updatePositiveSegmentsUDF(RuleEngineAerospikeConnection.java:217) at main.java.labs.Segment$ProductChecker.onSuccess(Segment.java:346) at com.aerospike.client.async.AsyncRead.onSuccess(AsyncRead.java:149) at com.aerospike.client.async.AsyncCommand.finish(AsyncCommand.java:293) at com.aerospike.client.async.AsyncSingleCommand.read(AsyncSingleCommand.java:59) at com.aerospike.client.async.AsyncCommand.run(AsyncCommand.java:261) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
在
execute
命令中,我有20个处于等待状态的线程。 我是否对设置做错了,因为我希望客户端返回,即使我的UDF中有任何异常,如果存在无限循环会发生什么? 它会导致这种行为吗?I am executing a udf using aeropike async client. The client has been initialized as:-
try { asyncClientPolicy.maxThreads = 40; asyncClientPolicy.asyncMaxCommands = 20; asyncClientPolicy.maxSocketIdle = 13; asyncClientPolicy.asyncMaxCommandAction = MaxCommandAction.BLOCK; asyncClientPolicy.asyncSelectorThreads = 7; asyncClientPolicy.asyncTaskThreadPool = Executors.newFixedThreadPool(20, new ThreadFactory() { public final Thread newThread(Runnable runnable) { Thread thread = new Thread(runnable); thread.setDaemon(true); return thread; } }); }
So I have 20 threads to handle the callbacks. After a while I see that my program is not doing any progress, indicating deadlock/starvation. Jstack gives me following result:-
java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x000000064048f338> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043) at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:374) at com.aerospike.client.async.AsyncCluster$BlockBufferQueue.getByteBuffer(AsyncCluster.java:114) at com.aerospike.client.async.AsyncCluster.getByteBuffer(AsyncCluster.java:68) at com.aerospike.client.async.AsyncCommand.execute(AsyncCommand.java:59) at com.aerospike.client.async.AsyncClient.execute(AsyncClient.java:949) at main.java.labs.RuleEngineAerospikeConnection.updatePositiveSegmentsUDF(RuleEngineAerospikeConnection.java:217) at main.java.labs.Segment$ProductChecker.onSuccess(Segment.java:346) at com.aerospike.client.async.AsyncRead.onSuccess(AsyncRead.java:149) at com.aerospike.client.async.AsyncCommand.finish(AsyncCommand.java:293) at com.aerospike.client.async.AsyncSingleCommand.read(AsyncSingleCommand.java:59) at com.aerospike.client.async.AsyncCommand.run(AsyncCommand.java:261) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)
I have exactly 20 threads in waiting state all on
execute
command. Am I doing something wrong with the setup, because I expect the client to return, even if there is any exception in my UDF, what happens if there is an infinite loop? could it lead to this behavior?
原文:https://stackoverflow.com/questions/45308357
相关问答
更多-
哪些浏览器(和版本)支持Canvas.toBlob方法?(Which browsers (and versions) support the Canvas.toBlob method?)[2021-10-11]
截至2016年2月 ,这些浏览器支持toBlob() Firefox 19 Chrome 50 IE10作为前缀msToBlob() 请注意,此答案最初是在2011年编写的。下面是原始答复/编辑。 toBlob()是新的,我不建议在消费者应用程序中使用它,除非您明确要求他们使用特定的浏览器(或者控制环境)。 toBlob()于5月12日添加,功能有限。 它不存在于Chrome每晚,Firefox每晚,也不存在IE9。 值得注意的是,Firefox确实有一个功能mozGetAsFile 甚至还没有关于将其添加 ... -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
toBlob方法是异步的,需要两个参数,回调函数和图像类型(可选第三个参数用于质量): void canvas.toBlob(callback,type,encoderOptions); 例 if (typeof canvas.toBlob !== "undefined") { canvas.toBlob(function(blob) { // send the blob to server etc. ... }, "image/jpeg", 0.75); } else if ...
-
由于gengkev在上面的评论中暗示,看起来最好/唯一的方法是使用异步xhr2调用: var xhr = new XMLHttpRequest(); xhr.open('GET', 'blob:http%3A//your.blob.url.here', true); xhr.responseType = 'blob'; xhr.onload = function(e) { if (this.status == 200) { var myBlob = this.response; // m ...
-
来自网址的Blob文件(Blob file from web URL)[2023-01-06]
像这样的东西应该工作: &HttpClient.Execute(!"GET", &PdfUrl) &HttpClient.ToFile(&PdfPath) &Blob = &PdfPath 哪里: &HttpClient是一个HttpClient类型的变量 &PdfUrl是一个基于Url域的变量,并存储了pdf文件的URL。 &PdfPath是Character类型的变量,并存储文件将被临时复制的路径。 &Blob是Blob类型的变量。 编辑:名为BlobFile新数据类型将在下一版GeneXus中引入( ... -
我已经做了一些研究,因为我也在这个问题上进行了研究,我认为唯一的可能性是做XHR请求。 我认为它已经在这里讨论: 如何从一个对象URL获取文件或blob? 如果你有一个blob,你可以用FileReader将它转换成一个ArrayBuffer 。 但也许下面的工作也可以发挥作用: xhr.responseType = 'arraybuffer'; I've done some research because I'm also interessted in this question and I thin ...
-
Canvas.toBlob()不下载一些PNG和非常高质量的JPG(Canvas.toBlob() not downloading some PNGs and very high quality JPGs)[2023-12-08]
我很好奇你为什么试图在第二个代码片段中附加一个onload处理程序到URL中? 这不是您链接的帖子所接受的答案的一部分。 它看起来像第二个代码片段几乎可以工作,但有几件事情不合适。 我相信这会起作用: function fileSave1() { var canvas = document.getElementById('cSave'); canvas.toBlob(function(blob) { const anchor = document.createElement('a') ... -
下面使用的'MSApp.CreateFileFromStorageFile()`将起作用。 如果需要使用WinJS.xhr()发送文件,可以在xhrOptions中设置为数据。 var uri = new Windows.Foundation.Uri('ms-appx:///images/IMG_0550.jpg'); var self = this; Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri ...
-
经过一番挖掘后,我们发现了https://code.google.com/p/chromium/issues/detail?id=294129 。 我的svg有一个
(基于d3的图表),这就是我遇到这个问题的原因。 使用数据uri而不是从blob加载svg解决了我的问题 After some digging came across https://code.google.com/p/chromium/issues/detail?id=294129. My svg was havi ... -
访问canvas.ToBlob()异步函数之外的blob值(access blob value outside of canvas.ToBlob() async function)[2023-07-06]
您可以使用Promise构造函数,将Blob实例传递给resolve() ,在.then()访问Promise值 function getCanvasBlob(canvas) { return new Promise(function(resolve, reject) { canvas.toBlob(function(blob) { resolve(blob) }) }) } var canvasBlob = getCanvasBlob(canvas); canvas ...