-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-19650. [ABFS] Fixing NPE when close() called on uninitialized filesystem #7880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
steveloughran
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 pending a small change to the javadocs around isClosed
| private Path workingDir; | ||
| private AzureBlobFileSystemStore abfsStore; | ||
| private boolean isClosed; | ||
| private boolean isClosed = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this really means inited and closed. Mention that in javadocs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, added the javadcoc.
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
:::: AGGREGATED TEST RESULT :::: ============================================================
|
| @Override | ||
| public synchronized void close() throws IOException { | ||
| if (isClosed) { | ||
| if (isClosed()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we throw an exception in case someone is trying to close non initialized or already closed file system?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fs.close() is supposed to be idempotent IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is chance that more two threads can attempt to close store and client which can cause similar issue what we got now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bhattmanish98 I don't see concurrency issues because close() is synchronized, and once closed it can't be closed again. Of course, once one thread has closed it, nobody else can use the instance. fix: don't do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steveloughran Make sense, I overlooked synchronized in the method definition. PR Looks good. Approved the changes.
| () -> fs.makeQualified(testPath)); | ||
|
|
||
| intercept(IllegalStateException.class, ERR_INVALID_ABFS_STATE, | ||
| () -> fs.setOwner(testPath, "", "")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EMPTY_STRING can be used here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will take up this.
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
bhattmanish98
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the added comment.
steveloughran
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
ready to merge.
| @Override | ||
| public synchronized void close() throws IOException { | ||
| if (isClosed) { | ||
| if (isClosed()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bhattmanish98 I don't see concurrency issues because close() is synchronized, and once closed it can't be closed again. Of course, once one thread has closed it, nobody else can use the instance. fix: don't do that.
Sure, just did a commit to rerun yetus, will merge as soon as green. |
|
🎊 +1 overall
This message was automatically generated. |
…AzureBlobFileSystem (apache#7880) Contributed by Anuj Modi
…AzureBlobFileSystem (apache#7880) Contributed by Anuj Modi
…AzureBlobFileSystem (apache#7880) Contributed by Anuj Modi
|
Will do backport for 3.4 and 3.4.2 |
Description of PR
AzureBlobFileSystem.close() throws NPE when called before initialize().
Before initialize, store is null.
Fix is to avoid calling any stor method before initialize is complete.
How was this patch tested?
New test added and existing tests were run.