On Mon, 13 May 2024 17:06:32 GMT, Naoto Sato <na...@openjdk.org> wrote:
>> Making sure `restoreEcho` correctly reflects the state in the shutdown >> thread, which differs from the application's thread that issues the >> `readPassword()` method. > > Naoto Sato has updated the pull request incrementally with one additional > commit since the last revision: > > Replaced another unused exception with _ Hm, I don't think we want to add any synchronized blocks within a shutdown hook. If a thread is blocked reading from the console, it will hold readLock; if the JVM is then shut down using a signal, it will run shutdown hooks, and this hook will block awaiting readLock. This can deadlock the shutdown completely. To ensure proper memory visibility, maybe consider making `restoreEcho` be volatile. ------------- PR Comment: https://git.openjdk.org/jdk/pull/19184#issuecomment-2108811013