You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2021/11/05 09:14:42 UTC
[GitHub] [bookkeeper] aloyszhang opened a new issue #2879: Journal thread exit while bookie is still on
aloyszhang opened a new issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879
**BUG REPORT**
Bookie does not exist when the on journal thread exists.
***Describe the bug***
I have a bookie which has three directories, after running for some days, the bookie is not healthy when test by
```shell
bin/bookkeeper shell bookiesanity
```
And the jstack show almost all `bookie-io` thread are waiting for journal adding an entry to the queue.
```
"bookie-io-1-20" #44 prio=5 os_prio=0 tid=0x00007f4741f02800 nid=0x57d8 waiting on condition [0x00007f46f7074000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000005778a3c88> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.ArrayBlockingQueue.put(ArrayBlockingQueue.java:353)
at org.apache.bookkeeper.bookie.Journal.logAddEntry(Journal.java:863)
at org.apache.bookkeeper.bookie.Journal.logAddEntry(Journal.java:852)
at org.apache.bookkeeper.bookie.Journal.logAddEntry(Journal.java:842)
at org.apache.bookkeeper.bookie.Bookie.addEntryInternal(Bookie.java:1265)
```
And also, there are only two threads for the journal left which means one journal thread exists.
So, all `addEntry` requests to this journal will be blocked after the queue is full, and eventually, all `bookie-io` threads will be blocked.
***Expected behavior***
Bookie should suicide at the point the journal thread exit.
***Additional context***
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] eolivelli commented on issue #2879: Journal thread exit while bookie is still on
Posted by GitBox <gi...@apache.org>.
eolivelli commented on issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879#issuecomment-961915952
`The Journal is a BookieCriticalThread `
in fact I am surprised that we are catching that exception.
Probably this is due to the fact that we are supporting multiple journals.
But I believe that we should terminate the Bookie as soon as possible.
`in the BookieImpl run() method with a check to see if any journal thread has exited, this will then lead to a controlled shutdown.`
I agree with this proposal.
@aloyszhang would you like to send to send a patch ?
you can use PowerMock in order to simulate the IO failure for instance
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] pradeepbn commented on issue #2879: Journal thread exit while bookie is still on
Posted by GitBox <gi...@apache.org>.
pradeepbn commented on issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879#issuecomment-962382033
@aloyszhang feel free to ping me on slack- we can chat if there is a potential overlap in our solution.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] aloyszhang commented on issue #2879: Journal thread exit while bookie is still on
Posted by GitBox <gi...@apache.org>.
aloyszhang commented on issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879#issuecomment-961748448
The logic about the journal thread exit is as follow:
https://github.com/apache/bookkeeper/blob/master/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java#L1145-L1156
```java
catch (IOException ioe) {
LOG.error("I/O exception in Journal thread!", ioe);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
LOG.info("Journal exits when shutting down");
} finally {
// There could be packets queued for forceWrite on this logFile
// That is fine as this exception is going to anyway take down the
// the bookie. If we execute this as a part of graceful shutdown,
// close will flush the file system cache making any previous
// cached writes durable so this is fine as well.
IOUtils.close(LOG, bc);
}
```
When breaking the while loop of the journal thread, bookie interrupts the journal thread and closes the BufferedChannel for the journal file.
I think it's better to exit all bookie services and maybe we also can add a catch block for Throwable
```java
catch (Throwable t) {
// print the cause
}
```
to check if there are some situations we didn't handle yet.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] Vanlightly commented on issue #2879: Journal thread exit while bookie is still on
Posted by GitBox <gi...@apache.org>.
Vanlightly commented on issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879#issuecomment-961885253
The Journal is a BookieCriticalThread so if we simply rethrow the exception it will terminate the bookie. This is not exactly a graceful shutdown though. A better alternative is to replace
```
// wait until journal quits
for (Journal journal: journals) {
journal.joinThread();
}
```
in the BookieImpl run() method with a check to see if any journal thread has exited, this will then lead to a controlled shutdown.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] aloyszhang commented on issue #2879: Journal thread exit while bookie is still on
Posted by GitBox <gi...@apache.org>.
aloyszhang commented on issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879#issuecomment-962372756
@eolivelli I'd like to fix this problem, but I see @pradeepbn has already sent a pull request https://github.com/apache/bookkeeper/pull/2868
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] Vanlightly commented on issue #2879: Journal thread exit while bookie is still on
Posted by GitBox <gi...@apache.org>.
Vanlightly commented on issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879#issuecomment-961885253
The Journal is a BookieCriticalThread so if we simply rethrow the exception it will terminate the bookie. This is not exactly a graceful shutdown though. A better alternative is to replace
```
// wait until journal quits
for (Journal journal: journals) {
journal.joinThread();
}
```
in the BookieImpl run() method with a check to see if any journal thread has exited, this will then lead to a controlled shutdown.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] Vanlightly commented on issue #2879: Journal thread exit while bookie is still on
Posted by GitBox <gi...@apache.org>.
Vanlightly commented on issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879#issuecomment-961885253
The Journal is a BookieCriticalThread so if we simply rethrow the exception it will terminate the bookie. This is not exactly a graceful shutdown though. A better alternative is to replace
```
// wait until journal quits
for (Journal journal: journals) {
journal.joinThread();
}
```
in the BookieImpl run() method with a check to see if any journal thread has exited, this will then lead to a controlled shutdown.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] eolivelli commented on issue #2879: Journal thread exit while bookie is still on
Posted by GitBox <gi...@apache.org>.
eolivelli commented on issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879#issuecomment-963105038
@aloyszhang you are correct #2868 is another problem
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] aloyszhang commented on issue #2879: Journal thread exit while bookie is still on
Posted by GitBox <gi...@apache.org>.
aloyszhang commented on issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879#issuecomment-962373469
Update, it seems #2868 is a different problem, so I'll send a patch, and please assign this issue to me @eolivelli
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] aloyszhang commented on issue #2879: Journal thread exit while bookie is still on
Posted by GitBox <gi...@apache.org>.
aloyszhang commented on issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879#issuecomment-961748448
The logic about the journal thread exit is as follow:
https://github.com/apache/bookkeeper/blob/master/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java#L1145-L1156
```java
catch (IOException ioe) {
LOG.error("I/O exception in Journal thread!", ioe);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
LOG.info("Journal exits when shutting down");
} finally {
// There could be packets queued for forceWrite on this logFile
// That is fine as this exception is going to anyway take down the
// the bookie. If we execute this as a part of graceful shutdown,
// close will flush the file system cache making any previous
// cached writes durable so this is fine as well.
IOUtils.close(LOG, bc);
}
```
When breaking the while loop of the journal thread, bookie interrupts the journal thread and closes the BufferedChannel for the journal file.
I think it's better to exit all bookie services and maybe we also can add a catch block for Throwable
```java
catch (Throwable t) {
// print the cause
}
```
to check if there are some situations we didn't handle yet.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] aloyszhang edited a comment on issue #2879: Journal thread exit while bookie is still on
Posted by GitBox <gi...@apache.org>.
aloyszhang edited a comment on issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879#issuecomment-962372756
@eolivelli I'd like to fix this problem, but I see @pradeepbn has already sent a pull request https://github.com/apache/bookkeeper/pull/2868 related to this issue, so I'm gonna to check #2868 first and then send a patch ASAP.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] eolivelli commented on issue #2879: Journal thread exit while bookie is still on
Posted by GitBox <gi...@apache.org>.
eolivelli commented on issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879#issuecomment-961915952
`The Journal is a BookieCriticalThread `
in fact I am surprised that we are catching that exception.
Probably this is due to the fact that we are supporting multiple journals.
But I believe that we should terminate the Bookie as soon as possible.
`in the BookieImpl run() method with a check to see if any journal thread has exited, this will then lead to a controlled shutdown.`
I agree with this proposal.
@aloyszhang would you like to send to send a patch ?
you can use PowerMock in order to simulate the IO failure for instance
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] aloyszhang commented on issue #2879: Journal thread exit while bookie is still on
Posted by GitBox <gi...@apache.org>.
aloyszhang commented on issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879#issuecomment-961748448
The logic about the journal thread exit is as follow:
https://github.com/apache/bookkeeper/blob/master/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java#L1145-L1156
```java
catch (IOException ioe) {
LOG.error("I/O exception in Journal thread!", ioe);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
LOG.info("Journal exits when shutting down");
} finally {
// There could be packets queued for forceWrite on this logFile
// That is fine as this exception is going to anyway take down the
// the bookie. If we execute this as a part of graceful shutdown,
// close will flush the file system cache making any previous
// cached writes durable so this is fine as well.
IOUtils.close(LOG, bc);
}
```
When breaking the while loop of the journal thread, bookie interrupts the journal thread and closes the BufferedChannel for the journal file.
I think it's better to exit all bookie services and maybe we also can add a catch block for Throwable
```java
catch (Throwable t) {
// print the cause
}
```
to check if there are some situations we didn't handle yet.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] aloyszhang edited a comment on issue #2879: Journal thread exit while bookie is still on
Posted by GitBox <gi...@apache.org>.
aloyszhang edited a comment on issue #2879:
URL: https://github.com/apache/bookkeeper/issues/2879#issuecomment-962372756
@eolivelli I'd like to fix this problem, but I see @pradeepbn has already sent a pull request https://github.com/apache/bookkeeper/pull/2868 related to this issue, so I'm gonna check #2868 first and then send a patch ASAP.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org