JDK-8168144 : [old doclet] Javadoc search index generation is not thread safe
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2016-10-18
  • Updated: 2021-03-09
  • Resolved: 2021-03-09
Related Reports
Relates :  
Description
AbstractIndexWriter.createSearchIndexFile creates unzipped json file, zips it and then deletes. If another thread deletes same unzipped index in the middle, the original one fails with NoSuchFileException on delete part.

Contents of the file may be just in memory or there may be a file-locking or just synchronization to make entire operation atomic.

Actual practical scenario is multi-threaded benchmarking so not sure if it is really an issue but there were no exceptions in the past.
Comments
This refers to the old doclet which is no longer supported
09-03-2021

I've marked it tbd_major, but the reality is that I would not expect this to be high enough priority to fix before the old doclet is removed. That being said, if it is important (for some reason) to fix this, the fix is relatively simple, and can be backported from the new doclet.
26-10-2016

Thanks for the update -- explicit use of the old entry point is the problem in this case. Although there is an equivalent class in the new world, it is (deliberately) in an unexported internal class. The simplest replacement would be to use the new java.util.spi.ToolProvider, which gives an API equivalent of the entry point used by the launcher. The exact same command line args should work.
19-10-2016

The code uses old entry point without any additional subtypes. Command line is like -quiet -use -keywords -encoding ISO-8859-1 -tag beaninfo:X -tag revised:X -tag since.unbundled:X -tag spec:X -tag specdefault:X -tag Note:X -tag ToDo:X -tag jls3:a:See <cite> The Java��� Language Specification</cite>: -source 1.7 and also there are -bootclasspath and -extdirs libraries in some cases. Thanks, regardless of the fix it makes sense to migrate to any ToolProvider.
19-10-2016

As shown by the classnames in the stacktrace, you're using the old version of the Standard Doclet, which has been completely superseded by a new version of the doclet in JDK 9, although the old one remains for backwards compatibility for those that need it. What is your javadoc command line? Are you using a user-provided subtype of the old Standard Doclet, or otherwise forcing javadoc to use this old code? Are you invoking the old entry point, com.sun.tools.javadoc.Main.execute directly? If so, that entry point has been deprecated. There are replacement entry points in either javax.tools.ToolProvider.getSystemDocumentationTool or the very recent new java.util.spi.ToolProvider.findFirst("javadoc") Bottom line, this issue has been fixed in the new Standard Doclet
19-10-2016

com.sun.tools.doclets.internal.toolkit.util.DocletAbortException: java.nio.file.NoSuchFileException: run-compiler/package-search-index.json at com.sun.tools.doclets.formats.html.AbstractIndexWriter.createSearchIndexFile(jdk.javadoc@9-internal/AbstractIndexWriter.java:411) at com.sun.tools.doclets.formats.html.AbstractIndexWriter.createSearchIndexFiles(jdk.javadoc@9-internal/AbstractIndexWriter.java:376) at com.sun.tools.doclets.formats.html.SingleIndexWriter.generateIndexFile(jdk.javadoc@9-internal/SingleIndexWriter.java:134) at com.sun.tools.doclets.formats.html.SingleIndexWriter.generate(jdk.javadoc@9-internal/SingleIndexWriter.java:80) at com.sun.tools.doclets.formats.html.HtmlDoclet.generateOtherFiles(jdk.javadoc@9-internal/HtmlDoclet.java:132) at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(jdk.javadoc@9-internal/AbstractDoclet.java:150) at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startDoclet(jdk.javadoc@9-internal/AbstractDoclet.java:89) at com.sun.tools.doclets.formats.html.HtmlDoclet.start(jdk.javadoc@9-internal/HtmlDoclet.java:80) at com.sun.tools.doclets.standard.Standard.start(jdk.javadoc@9-internal/Standard.java:44) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-internal/Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@9-internal/NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-internal/DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(java.base@9-internal/Method.java:535) at com.sun.tools.javadoc.main.DocletInvoker.invoke(jdk.javadoc@9-internal/DocletInvoker.java:332) at com.sun.tools.javadoc.main.DocletInvoker.start(jdk.javadoc@9-internal/DocletInvoker.java:211) at com.sun.tools.javadoc.main.Start.parseAndExecute(jdk.javadoc@9-internal/Start.java:443) at com.sun.tools.javadoc.main.Start.begin(jdk.javadoc@9-internal/Start.java:237) at com.sun.tools.javadoc.main.Start.begin(jdk.javadoc@9-internal/Start.java:223) at com.sun.tools.javadoc.Main.execute(jdk.javadoc@9-internal/Main.java:75) ... Caused by: java.nio.file.NoSuchFileException: run-compiler/package-search-index.json at sun.nio.fs.UnixException.translateToIOException(java.base@9-internal/UnixException.java:92) at sun.nio.fs.UnixException.rethrowAsIOException(java.base@9-internal/UnixException.java:111) at sun.nio.fs.UnixException.rethrowAsIOException(java.base@9-internal/UnixException.java:116) at sun.nio.fs.UnixFileSystemProvider.implDelete(java.base@9-internal/UnixFileSystemProvider.java:245) at sun.nio.fs.AbstractFileSystemProvider.delete(java.base@9-internal/AbstractFileSystemProvider.java:105) at java.nio.file.Files.delete(java.base@9-internal/Files.java:1129) at com.sun.tools.doclets.formats.html.AbstractIndexWriter.createSearchIndexFile(jdk.javadoc@9-internal/AbstractIndexWriter.java:409) ... 32 more
18-10-2016

jdk9/langtools version 2fd02a123cf0 (latest)
18-10-2016

What version of the code are you looking at? Have you checked the latest version, where there have been changes in this area?
18-10-2016