Insufficient space for shared memory file: Failed to create cache dir

Java HotSpot(TM) 64-Bit Server VM warning: Insufficient space for shared memory file:
   21636
Try using the -Djava.io.tmpdir= option to select an alternate temp location.

Exception in thread "main" java.lang.IllegalStateException: Failed to create cache dir
    at io.vertx.core.file.impl.FileResolver.setupCacheDir(FileResolver.java:332)
    at io.vertx.core.file.impl.FileResolver.<init>(FileResolver.java:87)
    at io.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:168)
    at io.vertx.core.impl.VertxImpl.vertx(VertxImpl.java:93)
    at io.vertx.core.impl.VertxFactoryImpl.vertx(VertxFactoryImpl.java:34)
    at io.vertx.core.Vertx.vertx(Vertx.java:85)
    at D5000DataService.runExample(D5000DataService.java:37)
    at D5000DataService.main(D5000DataService.java:20)
    
这个线上问题的核心在于留给共享内存文件的空间不足。vertx使用Http服务时需创建缓存目录。Linux下为登录用户对应的tmp文件夹下,创建vertx缓存目录。如果tmp文件夹被占满,无法再放入缓存文件,此服务器又部署了多个服务,你不敢删除,怕有用,或者你权限不足,根本不让删除,那么就会造成这个问题。
共享内存文件的空间不足,可以改变登录用户,那么默认的缓存目录创建位置会改变。
如果不想改变登录用户,那么可以显式改变vertx缓存目录创建位置。如java -cp jar包路径 程序入口类名,写成:java -Djava.io.tmpdir=./tmp jar包路径 程序入口类名。./tmp为当前目录下的tmp文件夹,注意提前创建此文件夹。
如果不想创建缓存目录,vertx.disableFileCPResolving=true应该适合你,还有个vertx.disableFileCaching=true设置,推荐前者。两者应用参考:https://github.com/eclipse-vertx/vert.x/issues/1931 。关于缓存目录创建源码,参考:https://www.cnblogs.com/cmfa/p/10550757.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

风铃峰顶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值