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

[Audio/Lavalink] ValueError: I/O operation on closed pipe when shutdown/restart while using default Java executable (solution inside) #6523

Open
mario31274 opened this issue Feb 8, 2025 · 0 comments
Labels
Status: Needs Triage This has not been labeled or discussed for handling yet. Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing.

Comments

@mario31274
Copy link

What Red version are you using?

3.5.16

What were you trying to do?

Shutdown the bot to update from 3.5.15 to 3.5.16

What did you expect to happen?

Shutdown peacefully and then restart the bot and Lavalink

What actually happened?

It occurred to me that one of my RedBot instances was raising error at asyncio:

Traceback (most recent call last):
  File "C:\Users\*****\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_subprocess.py", line 126, in __del__
    self.close()
  File "C:\Users\*****\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_subprocess.py", line 104, in close
    proto.pipe.close()
  File "C:\Users\*****\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Users\*****\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 758, in call_soon
    self._check_closed()
  File "C:\Users\*****\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 519, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000018F1C2623E0>
Traceback (most recent call last):
  File "C:\Users\*****\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 115, in __del__
    _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\*****\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 79, in __repr__
    info.append(f'fd={self._sock.fileno()}')
                      ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\*****\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_utils.py", line 102, in fileno
    raise ValueError("I/O operation on closed pipe")
ValueError: I/O operation on closed pipe

which failed to terminate java.exe and blocked the port, making it impossible to restart Lavalink.

How can we reproduce this error?

  1. !llset java to set to the default java executable. The default executable for me was C:\Program Files\Common Files\Oracle\Java\javapath\java.EXE
  2. !shutdown or !restart
  3. ValueError will occur

Anything else?

Temporary solution: Change your Java executable to Java 11.

This error did not happen on the instance that uses a different Java executable (jdk-11.0.16). No error occurred when shutting down/restarting while using this version of java.exe. I lost an hour and a half because I thought the problem was the port or the Lavalink.exe.

@mario31274 mario31274 added the Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing. label Feb 8, 2025
@github-actions github-actions bot added the Status: Needs Triage This has not been labeled or discussed for handling yet. label Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage This has not been labeled or discussed for handling yet. Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing.
Projects
None yet
Development

No branches or pull requests

1 participant