Vertx线程阻止了警告

时间:2017-12-08 05:54:05

标签: vert.x

我在ubuntu服务器上运行vert.x应用程序。它有一个在端口3000上运行的HTTPServer。应用程序工作正常,但有时我看到以下警告:

Dec 08, 2017 1:23:43 AM io.vertx.core.impl.BlockedThreadChecker
WARNING: Thread Thread[vert.x-worker-thread-2,5,main] has been blocked for 138013 ms, time limit is 60000
io.vertx.core.VertxException: Thread blocked
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:255)
    at sun.security.provider.NativePRNG$RandomIO.readFully(NativePRNG.java:424)
    at sun.security.provider.NativePRNG$RandomIO.implGenerateSeed(NativePRNG.java:441)
    at sun.security.provider.NativePRNG$RandomIO.access$500(NativePRNG.java:331)
    at sun.security.provider.NativePRNG.engineGenerateSeed(NativePRNG.java:226)
    at java.security.SecureRandom.generateSeed(SecureRandom.java:533)
    at io.vertx.ext.auth.PRNG.lambda$null$0(PRNG.java:78)
    at io.vertx.ext.auth.PRNG$$Lambda$204/767088095.handle(Unknown Source)
    at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:271)
    at io.vertx.core.impl.ContextImpl$$Lambda$206/1202956360.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Dec 08, 2017 1:23:44 AM io.vertx.core.impl.BlockedThreadChecker
WARNING: Thread Thread[vert.x-worker-thread-2,5,main] has been blocked for 139014 ms, time limit is 60000
io.vertx.core.VertxException: Thread blocked
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:255)
    at sun.security.provider.NativePRNG$RandomIO.readFully(NativePRNG.java:424)
    at sun.security.provider.NativePRNG$RandomIO.implGenerateSeed(NativePRNG.java:441)
    at sun.security.provider.NativePRNG$RandomIO.access$500(NativePRNG.java:331)
    at sun.security.provider.NativePRNG.engineGenerateSeed(NativePRNG.java:226)
    at java.security.SecureRandom.generateSeed(SecureRandom.java:533)
    at io.vertx.ext.auth.PRNG.lambda$null$0(PRNG.java:78)
    at io.vertx.ext.auth.PRNG$$Lambda$204/767088095.handle(Unknown Source)
    at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:271)
    at io.vertx.core.impl.ContextImpl$$Lambda$206/1202956360.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Dec 08, 2017 1:23:45 AM io.vertx.core.impl.BlockedThreadChecker
WARNING: Thread Thread[vert.x-worker-thread-2,5,main] has been blocked for 140013 ms, time limit is 60000
io.vertx.core.VertxException: Thread blocked
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:255)
    at sun.security.provider.NativePRNG$RandomIO.readFully(NativePRNG.java:424)
    at sun.security.provider.NativePRNG$RandomIO.implGenerateSeed(NativePRNG.java:441)
    at sun.security.provider.NativePRNG$RandomIO.access$500(NativePRNG.java:331)
    at sun.security.provider.NativePRNG.engineGenerateSeed(NativePRNG.java:226)
    at java.security.SecureRandom.generateSeed(SecureRandom.java:533)
    at io.vertx.ext.auth.PRNG.lambda$null$0(PRNG.java:78)
    at io.vertx.ext.auth.PRNG$$Lambda$204/767088095.handle(Unknown Source)
    at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:271)
    at io.vertx.core.impl.ContextImpl$$Lambda$206/1202956360.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Dec 08, 2017 1:23:46 AM io.vertx.core.impl.BlockedThreadChecker
WARNING: Thread Thread[vert.x-worker-thread-2,5,main] has been blocked for 141013 ms, time limit is 60000
io.vertx.core.VertxException: Thread blocked
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:255)
    at sun.security.provider.NativePRNG$RandomIO.readFully(NativePRNG.java:424)
    at sun.security.provider.NativePRNG$RandomIO.implGenerateSeed(NativePRNG.java:441)
    at sun.security.provider.NativePRNG$RandomIO.access$500(NativePRNG.java:331)
    at sun.security.provider.NativePRNG.engineGenerateSeed(NativePRNG.java:226)
    at java.security.SecureRandom.generateSeed(SecureRandom.java:533)
    at io.vertx.ext.auth.PRNG.lambda$null$0(PRNG.java:78)
    at io.vertx.ext.auth.PRNG$$Lambda$204/767088095.handle(Unknown Source)
    at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:271)
    at io.vertx.core.impl.ContextImpl$$Lambda$206/1202956360.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Dec 08, 2017 1:23:47 AM io.vertx.core.impl.BlockedThreadChecker
WARNING: Thread Thread[vert.x-worker-thread-2,5,main] has been blocked for 142013 ms, time limit is 60000
io.vertx.core.VertxException: Thread blocked
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:255)
    at sun.security.provider.NativePRNG$RandomIO.readFully(NativePRNG.java:424)
    at sun.security.provider.NativePRNG$RandomIO.implGenerateSeed(NativePRNG.java:441)
    at sun.security.provider.NativePRNG$RandomIO.access$500(NativePRNG.java:331)
    at sun.security.provider.NativePRNG.engineGenerateSeed(NativePRNG.java:226)
    at java.security.SecureRandom.generateSeed(SecureRandom.java:533)
    at io.vertx.ext.auth.PRNG.lambda$null$0(PRNG.java:78)
    at io.vertx.ext.auth.PRNG$$Lambda$204/767088095.handle(Unknown Source)
    at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:271)
    at io.vertx.core.impl.ContextImpl$$Lambda$206/1202956360.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Dec 08, 2017 1:23:48 AM io.vertx.core.impl.BlockedThreadChecker
WARNING: Thread Thread[vert.x-worker-thread-2,5,main] has been blocked for 143013 ms, time limit is 60000
io.vertx.core.VertxException: Thread blocked
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:255)
    at sun.security.provider.NativePRNG$RandomIO.readFully(NativePRNG.java:424)
    at sun.security.provider.NativePRNG$RandomIO.implGenerateSeed(NativePRNG.java:441)
    at sun.security.provider.NativePRNG$RandomIO.access$500(NativePRNG.java:331)
    at sun.security.provider.NativePRNG.engineGenerateSeed(NativePRNG.java:226)
    at java.security.SecureRandom.generateSeed(SecureRandom.java:533)
    at io.vertx.ext.auth.PRNG.lambda$null$0(PRNG.java:78)
    at io.vertx.ext.auth.PRNG$$Lambda$204/767088095.handle(Unknown Source)
    at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:271)
    at io.vertx.core.impl.ContextImpl$$Lambda$206/1202956360.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Dec 08, 2017 1:23:49 AM io.vertx.core.impl.BlockedThreadChecker
WARNING: Thread Thread[vert.x-worker-thread-2,5,main] has been blocked for 144013 ms, time limit is 60000
io.vertx.core.VertxException: Thread blocked
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:255)
    at sun.security.provider.NativePRNG$RandomIO.readFully(NativePRNG.java:424)
    at sun.security.provider.NativePRNG$RandomIO.implGenerateSeed(NativePRNG.java:441)
    at sun.security.provider.NativePRNG$RandomIO.access$500(NativePRNG.java:331)
    at sun.security.provider.NativePRNG.engineGenerateSeed(NativePRNG.java:226)
    at java.security.SecureRandom.generateSeed(SecureRandom.java:533)
    at io.vertx.ext.auth.PRNG.lambda$null$0(PRNG.java:78)
    at io.vertx.ext.auth.PRNG$$Lambda$204/767088095.handle(Unknown Source)
    at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:271)
    at io.vertx.core.impl.ContextImpl$$Lambda$206/1202956360.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Dec 08, 2017 1:23:50 AM io.vertx.core.impl.BlockedThreadChecker
WARNING: Thread Thread[vert.x-worker-thread-2,5,main] has been blocked for 145013 ms, time limit is 60000
io.vertx.core.VertxException: Thread blocked
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:255)
    at sun.security.provider.NativePRNG$RandomIO.readFully(NativePRNG.java:424)
    at sun.security.provider.NativePRNG$RandomIO.implGenerateSeed(NativePRNG.java:441)
    at sun.security.provider.NativePRNG$RandomIO.access$500(NativePRNG.java:331)
    at sun.security.provider.NativePRNG.engineGenerateSeed(NativePRNG.java:226)
    at java.security.SecureRandom.generateSeed(SecureRandom.java:533)
    at io.vertx.ext.auth.PRNG.lambda$null$0(PRNG.java:78)
    at io.vertx.ext.auth.PRNG$$Lambda$204/767088095.handle(Unknown Source)
    at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:271)
    at io.vertx.core.impl.ContextImpl$$Lambda$206/1202956360.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

我无法理解导致这些警告出现的原因。在发出警告时,服务器处于空闲状态,应用程序上有0个流量。此外,我正在使用vertx periodic运行调度程序,这使得每隔15秒进行一次mongo查询。

vertx.setPeriodic(15000, r -> someService.check()); // Every 15 seconds

2 个答案:

答案 0 :(得分:6)

似乎没有足够的熵(服务器空闲)来馈送PRNG。因此,SecureRandom.generateSeed方法不会快速返回,而是阻塞,直到获得足够的数据。

根据您的硬件,您可以使用rng-tools加快整个过程。

答案 1 :(得分:0)

您是否正在使用vertx.executeBlocking()执行阻止api调用?在我看来,您可能在someService.check()或其他任何地方

中有某个阻塞API调用