Skip to content
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

Make readBuffered blocking and add a readBuffered with a timeout, fix… #782

Merged
merged 1 commit into from
Jan 16, 2023

Conversation

gnodet
Copy link
Member

@gnodet gnodet commented May 19, 2022

…es #757

@@ -105,15 +105,15 @@ public int readBuffered(char[] b) throws IOException {
b[0] = (char) ch;
ch = READ_EXPIRED;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THREAD_SAFETY_VIOLATION: Unprotected write. Non-private method NonBlockingReaderImpl.readBuffered(...) writes to field this.ch outside of synchronization.
Reporting because another access to the same memory occurs on a background thread, although this access may not.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@@ -105,15 +105,15 @@ public int readBuffered(char[] b) throws IOException {
b[0] = (char) ch;
ch = READ_EXPIRED;
return 1;
} else if (!threadIsReading) {
} else if (!threadIsReading && timeout <= 0) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THREAD_SAFETY_VIOLATION: Read/Write race. Non-private method NonBlockingReaderImpl.readBuffered(...) reads without synchronization from this.threadIsReading. Potentially races with write in method NonBlockingReaderImpl.read(...).
Reporting because another access to the same memory occurs on a background thread, although this access may not.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

} else if (b.length == 0) {
} else if (off < 0 || len < 0 || off + len < b.length) {
throw new IllegalArgumentException();
} else if (len == 0) {
return 0;
} else if (exception != null) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THREAD_SAFETY_VIOLATION: Read/Write race. Non-private method NonBlockingReaderImpl.readBuffered(...) reads without synchronization from this.exception. Potentially races with write in method NonBlockingReaderImpl.read(...).
Reporting because another access to the same memory occurs on a background thread, although this access may not.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@@ -105,15 +107,16 @@ public int readBuffered(char[] b) throws IOException {
b[0] = (char) ch;
ch = READ_EXPIRED;
return 1;
} else if (!threadIsReading) {
return in.read(b);
} else if (!threadIsReading && timeout <= 0) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THREAD_SAFETY_VIOLATION: Read/Write race. Non-private method NonBlockingReaderImpl.readBuffered(...) reads without synchronization from this.threadIsReading. Potentially races with write in method NonBlockingReaderImpl.read(...).
Reporting because another access to the same memory occurs on a background thread, although this access may not.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@@ -105,15 +107,16 @@ public int readBuffered(char[] b) throws IOException {
b[0] = (char) ch;
ch = READ_EXPIRED;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THREAD_SAFETY_VIOLATION: Unprotected write. Non-private method NonBlockingReaderImpl.readBuffered(...) writes to field this.ch outside of synchronization.
Reporting because another access to the same memory occurs on a background thread, although this access may not.

(at-me in a reply with help or ignore)


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant