[
https://issues.apache.org/jira/browse/FLINK-6370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16010579#comment-16010579
]
ASF GitHub Bot commented on FLINK-6370:
---------------------------------------
Github user zentol commented on a diff in the pull request:
https://github.com/apache/flink/pull/3896#discussion_r116500027
--- Diff:
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/files/StaticFileServerHandler.java
---
@@ -234,8 +237,17 @@ private void respondAsLeader(ChannelHandlerContext
ctx, HttpRequest request, Str
if
(!rootURI.relativize(requestedURI).equals(requestedURI)) {
logger.debug("Loading missing file from classloader: {}", requestPath);
// ensure that
directory to file exists.
-
file.getParentFile().mkdirs();
-
Files.copy(resourceStream, file.toPath());
+ if
(!file.getParentFile().mkdirs()) {
+ throw
new IOException("Could not create directories for file " + file);
+ }
+ synchronized
(COPY_LOCK) {
--- End diff --
Because this was easy to write, is easy to review, does not change any
behavior and isn't particularly intrusive.
I agree that we should have a discussion as to whether we should load the
files lazily or not, but not now when the next release is coming up and
everyone is scrambling to fix the most issues in as little time as possible
> FileAlreadyExistsException on startup
> -------------------------------------
>
> Key: FLINK-6370
> URL: https://issues.apache.org/jira/browse/FLINK-6370
> Project: Flink
> Issue Type: Bug
> Components: Webfrontend
> Affects Versions: 1.2.0
> Reporter: Andrey
> Assignee: Chesnay Schepler
>
> Currently static web resources are lazily cached onto disk during first
> request. However if 2 concurrent requests will be executed, then
> FileAlreadyExistsException will be in logs.
> {code}
> 2017-04-24 14:00:58,075 ERROR
> org.apache.flink.runtime.webmonitor.files.StaticFileServerHandler - error
> while responding [nioEventLoopGroup-3-2]
> java.nio.file.FileAlreadyExistsException:
> /flink/web/flink-web-528f8cb8-dd60-433c-8f6c-df49ad0b79e0/index.html
> at
> sun.nio.fs.UnixException.translateToIOException(UnixException.java:88)
> at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
> at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
> at
> sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
> at
> java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:434)
> at java.nio.file.Files.newOutputStream(Files.java:216)
> at java.nio.file.Files.copy(Files.java:3016)
> at
> org.apache.flink.runtime.webmonitor.files.StaticFileServerHandler.respondAsLeader(StaticFileServerHandler.java:238)
> at
> org.apache.flink.runtime.webmonitor.files.StaticFileServerHandler.channelRead0(StaticFileServerHandler.java:197)
> at
> org.apache.flink.runtime.webmonitor.files.StaticFileServerHandler.channelRead0(StaticFileServerHandler.java:99)
> at
> io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
> at
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)
> at
> io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)
> at io.netty.handler.codec.http.router.Handler.routed(Handler.java:62)
> {code}
> Expect:
> * extract all static resources on startup in main thread and before opening
> http port.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)