生成图片报错,Can‘tcreatecachefile!,FileSystemExcept。。。

更新时间:2023-06-27 19:47:07 阅读: 评论:0

⽣成图⽚报错,Can‘tcreatecachefile!,FileSystemExcept。
。。
主要环境:
centos7、docker、springboot
问题叙述:
运⾏已久的客户线上环境,系统验证码图⽚不显⽰,经看接⼝返回值为null,看服务⽇志发现已经报错,错误⽇志如下。
javax.imageio.IIOException: Can't create cache file!
at javax.ateImageOutputStream(ImageIO.java:423)
at javax.imageio.ImageIO.write(ImageIO.java:1583)
at com.yudao.pay.gateway.RandomCode(CaptchaService.java:68)
at com.yudao.Captcha(LoginController.java:41)
flect.GeneratedMethodAccessor581.invoke(Unknown Source)
flect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at flect.Method.invoke(Method.java:498)
at org.hod.InvocableHandlerMethod.lambda$invoke$0(InvocableHandlerMethod.java:137)
SubscribeScalarMap(FluxFlatMap.java:141)
publisher.MonoFlatMap.subscribe(MonoFlatMap.java:53)
publisher.MonoDefer.subscribe(MonoDefer.java:52)
publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.java:153)
publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:56)
mac剪切
publisher.MonoPeekFuable.subscribe(MonoPeekFuable.java:74)
publisher.MonoPeekFuable.subscribe(MonoPeekFuable.java:74)
药物外渗
publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.java:44)
publisher.Next(MonoFlatMap.java:150)
publisher.Next(FluxSwitchIfEmpty.java:67)
publisher.Next(MonoNext.java:76)
publisher.FluxConcatMap$ConcatMapImmediate.innerNext(FluxConcatMap.java:275)
publisher.Next(FluxConcatMap.java:849)
publisher.Next(FluxMapFuable.java:121)
publisher.quest(Operators.java:2071)
publisher.quest(FluxMapFuable.java:162)
publisher.Operators$MultiSubscriptionSubscriber.t(Operators.java:1879)
publisher.Subscribe(Operators.java:1753)
publisher.Subscribe(FluxMapFuable.java:90)
publisher.MonoJust.subscribe(MonoJust.java:54)
publisher.MonoMapFuable.subscribe(MonoMapFuable.java:59)
publisher.Mono.subscribe(Mono.java:3852)
publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:442)
publisher.Subscribe(FluxConcatMap.java:212)
publisher.FluxIterable.subscribe(FluxIterable.java:139)
publisher.FluxIterable.subscribe(FluxIterable.java:63)
publisher.FluxConcatMap.subscribe(FluxConcatMap.java:121)
publisher.MonoNext.subscribe(MonoNext.java:40)
publisher.MonoSwitchIfEmpty.subscribe(MonoSwitchIfEmpty.java:44)
publisher.MonoFlatMap.subscribe(MonoFlatMap.java:60)
publisher.MonoFlatMap.subscribe(MonoFlatMap.java:60)
publisher.MonoDefer.subscribe(MonoDefer.java:52)
publisher.MonoDefer.subscribe(MonoDefer.java:52)
publisher.Next(MonoFlatMap.java:150)
publisher.plete(Operators.java:1515)
癫痫病能根治吗publisher.MonoZip$ZipCoordinator.signal(MonoZip.java:247)
publisher.Next(MonoZip.java:329)
publisher.quest(Operators.java:2071)
publisher.Subscribe(MonoZip.java:318)
publisher.MonoJust.subscribe(MonoJust.java:54)
publisher.Mono.subscribe(Mono.java:3852)
publisher.MonoZip.subscribe(MonoZip.java:128)
publisher.MonoZip.subscribe(MonoZip.java:128)
publisher.MonoFlatMap.subscribe(MonoFlatMap.java:60)
publisher.MonoDefer.subscribe(MonoDefer.java:52)
publisher.MonoDefer.subscribe(MonoDefer.java:52)
publisher.MonoPeekTerminal.subscribe(MonoPeekTerminal.java:61)上课玩手机
publisher.MonoPeekFuable.subscribe(MonoPeekFuable.java:74)
publisher.MonoDefer.subscribe(MonoDefer.java:52)
publisher.MonoDefer.subscribe(MonoDefer.java:52)
publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.java:44)
publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.java:44)
publisher.MonoPeekTerminal.subscribe(MonoPeekTerminal.java:61)
publisher.MonoOnErrorResume.subscribe(MonoOnErrorResume.java:44)
publisher.Mono.subscribe(Mono.java:3852)
publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.java:172)
publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:56)
西洋参枸杞publisher.MonoPeekFuable.subscribe(MonoPeekFuable.java:70)
publisher.MonoPeekTerminal.subscribe(MonoPeekTerminal.java:61)
at reactorty.http.StateChange(HttpServerHandle.java:64)
p.StateChange(TcpServerBind.java:226)
at reactorty.http.InboundNext(HttpServerOperations.java:442)
at reactorty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:91)
at ioty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
at ioty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
at ioty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
at reactorty.http.rver.HttpTrafficHandler.channelRead(HttpTrafficHandler.java:161)
at ioty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
at ioty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
at ioty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
at ioty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438)        at dec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:328)
at dec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:302)
at ioty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)
at ioty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerCo
宪法手抄报大全ntext.java:374)
at ioty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
at ioty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
at ioty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1421)
at ioty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
at ioty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
at ioty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930)
at ioty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:794)
at ioty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:424)
at ioty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:326)
at urrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918)
at ioty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at urrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Caud by: java.nio.file.FileSystemException: /p: No space left on device
at sun.nio.anslateToIOException(UnixException.java:91)
at sun.nio.hrowAsIOException(UnixException.java:102)
at sun.nio.hrowAsIOException(UnixException.java:107)
at sun.nio.wByteChannel(UnixFileSystemProvider.java:214)
at java.nio.wByteChannel(Files.java:361)
at java.nio.ateFile(Files.java:632)
at java.nio.ate(TempFileHelper.java:138)
at java.nio.ateTempFile(TempFileHelper.java:161)
at java.nio.ateTempFile(Files.java:897)
at javax.imageio.stream.FileCacheImageOutputStream.<init>(FileCacheImageOutputStream.java:88)
at com.sun.imageio.ateOutputStreamInstance(OutputStreamImageOutputStreamSpi.java:68)
at javax.ateImageOutputStream(ImageIO.java:419)
... 94 common frames omitted
javax.imageio.IIOException: Can't create cache file!
通过这个⽇志看到⽆法⽣成⽂件,这块代码是这样的使⽤javax进⾏画图操作,其中⼀步需要把流写到磁盘上,⽽我们在项⽬中也没有配置更改tomcat的默认临时路径,这就导致使⽤tomcat默认临时路径问题,因为tomcat运⾏⼀段时间临时⽬录会被清空,那么我们重启下不就⾏了,然后重启这个容器发现还是这个问题,那么就要看下磁盘空间使⽤率,如下图:
df -h
通过df -h,看到系统磁盘使⽤情况,虽然磁盘使⽤率还是⽐较⾼,但是还不⾄于空间不⾜,这⾥可以先排除了,因为是线上需要快速解决这个问题,这时想到有可能是docker容器的问题,先把这个容器给停了,然后把该容器删除或者回收了,docker system prune,然后再重新创建容器启动,正常了。
全民消防生命至上经过上⾯操作,这个问题是这样临时解决的,其实上⾯清除容器然后再创建,然后问题解决了,就怀疑容器的空间使⽤率。
df -i
查看如下图:
公立医院改革
果不其然 overlay这个⽬录已经100%, 对docker了解的不是很深⼊,⼤概了解了下,overlay2存储的是容器相关的,容器元数据等等,随着容器运⾏数据会不断增加,到此为⽌问题算是找到根本原因了。
其实上⾯解决也并不是tomcat临时路径的问题,tmp路径是存在的,这个画图只是⽤到临时⽬录,所以真正问题所在并不是tomcat临时路径问题,重启没有⽤的。
解决⽅法:
清理overlay2⽬录,对docker了解不是很深⼊,这个需要通过资料学习怎么清理这个⽬录,后续会更新⼀篇⽂章。
关于tomcat临时路径问题,也就解决办法,虽然这个项⽬这个问题和临时⽬录没有关系,但是项⽬配置还是要加上相关配置的,这个问题之所以和tomcat临时⽬录没有关系,是因为我们要借⽤临时⽬录把流存储下来后续不会很长时间的使⽤,所以不会出现我们⽣成的图⽚,在使⽤时被tomcat清空,这个要看使⽤场景,例如系统根据节⽇⽣成海报,且长时间使⽤,这个时候可能会导致,后续读取海报时找不到
⽂件,因为可能被清空了。这个具体配置我就不赘述了,⽹上很多。

本文发布于:2023-06-27 19:47:07,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1053547.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:问题   容器   路径   系统   配置   磁盘   导致
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图