Ethanlm commented on a change in pull request #3226: [STORM-3583] Handle
exceptions when AsyncLocalizer tries to get local resources
URL: https://github.com/apache/storm/pull/3226#discussion_r392282651
##########
File path:
storm-server/src/main/java/org/apache/storm/localizer/AsyncLocalizer.java
##########
@@ -456,7 +459,28 @@ public void releaseSlotFor(LocalAssignment assignment,
int port) throws IOExcept
topoConfBlob.removeReference(pna);
}
- for (LocalResource lr : getLocalResources(pna)) {
+
+ // ALERT: A possible race condition could be resolved by separating
the thread pools into downloadExecService and taskExecService
+ //
https://git.ouroath.com/storm/storm/commit/ebd52b37c7448d381d31451e46e8f19c6e51352d#diff-74535cb89e9e926ad424a8d1e2fa9586
+ // Will need further investigation if the race condition happens again
+ List<LocalResource> localResources;
+ try {
+ // Precondition1: Base blob stormconf.ser and stormcode.ser have
been localized
+ // Precondition2: Both these two blob files are fully downloaded
and proper permission been set
+ localResources = getLocalResources(pna);
+ } catch (FileNotFoundException fnfException) {
+ localResourceFileNotFound.mark();
+ LOG.warn("Local base blobs have not been downloaded yet. "
+ + "DownloadExecService is too busy", fnfException);
+ LOG.info("Port and assignment info: {}", pna);
+ return;
+ } catch (IOException ioException) {
+ LOG.error("Unable to read local conf file. ", ioException);
+ LOG.info("Port and assignment info: {}", pna);
Review comment:
`LOG.info("Port and assignment info: {}", pna); ` are repeated twice here.
We can write it in the following way:
```
catch (IOException e) {
//common1
if (e instanceof FileNotFoundException) {
//xx
} else {
//yy
}
// common2
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services