# Kernel Stops Executing Subsequent Code After input() Call (and thus no output) with Custom WebSocket Client

**URL:** <https://discourse.jupyter.org/t/kernel-stops-executing-subsequent-code-after-input-call-and-thus-no-output-with-custom-websocket-client/37185>\
**Category:** Kernels\
**Created:** [July 30, 2025, 3:32pm UTC](https://discourse.jupyter.org/t/kernel-stops-executing-subsequent-code-after-input-call-and-thus-no-output-with-custom-websocket-client/37185 "2025-07-30T15:32:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zurab\_Shahbanov](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/zurab_shahbanov/32/19608_2.png) [@Zurab\_Shahbanov](https://discourse.jupyter.org/u/Zurab_Shahbanov)\
**Post date:** [July 30, 2025, 3:32pm UTC](https://discourse.jupyter.org/t/kernel-stops-executing-subsequent-code-after-input-call-and-thus-no-output-with-custom-websocket-client/37185/1 "2025-07-30T15:32:58Z")

</div>

Hi

I’m developing a custom web IDE client that connects to Jupyter Kernel Gateway via WebSockets. My client correctly sends `execute_request`, handles `input_request`, and sends `input_reply`.

**The Problem:**

When my client sends code that includes an `input()` call, the kernel executes the code _before_ `input()`. After `input_reply` is sent by my client and received by Kernel Gateway, **the kernel appears to stop executing any subsequent code**. Consequently, no further `iopub` messages (like `stream`, `display_data`, or `execute_result`) are sent back to my client.

```python
Example Code:print("Part 1: This output works.")
my_input = input("Enter something: ")
print(f"Part 2: This output is NEVER seen.") # Kernel never executes this line
2 + 2 # Kernel never executes this line either

```

**Key Observations:**

- Initial `print()` statements _before_ `input()` work fine.

- My client successfully receives `input_request` and sends `input_reply` (confirmed by Kernel Gateway logs).

- **Kernel Gateway logs confirm the `input_reply` is received, but show no further activity (no `stream`, `display_data`, or `execute_result` messages) after this point.**

- The exact same code executes completely (including all subsequent output) when run in Jupyter Notebook/Lab connected to the _same_ Kernel Gateway.

This strongly suggests the issue is that the kernel ceases execution after processing `input_reply` specifically from my custom client.

**Relevant Logs:** (Provide your concise KG logs here, showing `execute_request`, initial outputs, `input_reply`, and then **nothing else** related to output/execution from the kernel.)

```bash
[15:10:26] [KernelGatewayApp] INFO: Kernel interrupted: 20b83b26-63dd-4823-a6d5-a9f268565e54
[I 250730 15:10:26 web:2407] 204 POST /api/kernels/20b83b26-63dd-4823-a6d5-a9f268565e54/interrupt (95.141.32.101) 1.79ms
[15:10:26] [KernelGatewayApp] DEBUG: activity on 20b83b26-63dd-4823-a6d5-a9f268565e54: error
[IPKernelApp] WARNING | Unknown message type: 'input_reply'
[15:10:26] [KernelGatewayApp] DEBUG: activity on 20b83b26-63dd-4823-a6d5-a9f268565e54: status (idle)
[15:10:26] [KernelGatewayApp] DEBUG: activity on 20b83b26-63dd-4823-a6d5-a9f268565e54: status (idle)
[15:10:26] [KernelGatewayApp] DEBUG: activity on 20b83b26-63dd-4823-a6d5-a9f268565e54: status (idle)
[15:10:40] [KernelGatewayApp] WARNING: No channel specified, assuming shell: {'header': {'msg_id': '74592e17-edc8-4e34-95ae-1461812c4531', 'session': '20b83b26-63dd-4823-a6d5-a9f268565e54', 'date': '2025-07-30T15:10:39.880Z', 'msg_type': 'execute_request', 'version': '5.3'}, 'parent_header': {}, 'metadata': {}, 'content': {'code': 'print("Part 1: This output works.")\nmy_input = input("Enter something: ")\nprint(f"Part 2: This output is NEVER seen.") \n2 + 2', 'silent': False, 'store_history': True, 'user_expressions': {}, 'allow_stdin': True, 'stop_on_error': True}, 'buffers': []}
[15:10:40] [KernelGatewayApp] DEBUG: activity on 20b83b26-63dd-4823-a6d5-a9f268565e54: status (busy)
[15:10:40] [KernelGatewayApp] DEBUG: activity on 20b83b26-63dd-4823-a6d5-a9f268565e54: execute_input
[15:10:40] [KernelGatewayApp] DEBUG: activity on 20b83b26-63dd-4823-a6d5-a9f268565e54: stream
[15:10:45] [KernelGatewayApp] WARNING: No channel specified, assuming shell: {'header': {'msg_id': '0a3e314a-9eb9-4dd7-bf4b-1418887f1013', 'session': '20b83b26-63dd-4823-a6d5-a9f268565e54', 'date': '2025-07-30T15:10:44.963Z', 'msg_type': 'input_reply', 'version': '5.3'}, 'parent_header': {'msg_id': '241b5b2e-7a30bccd8f19f9a864a4de24_4603_22'}, 'metadata': {}, 'content': {'value': 'Python', 'status': 'ok'}, 'buffers': []}

```

**Question:** Why would the kernel stop executing code after receiving an input\_reply from a custom WebSocket client, when the same behavior does not occur with official Jupyter clients? Is there a specific protocol expectation or session management aspect that might be causing the kernel to halt execution? How to solve this problem?

[link to my IDE](https://s3.shakhbanov.org/python.html)

# jupyter\_kernel\_gateway\_config.py

c.KernelGatewayApp.allow\_origin = ‘\*’

c.KernelGatewayApp.allow\_headers = ‘Content-Type,Authorization’

c.KernelGatewayApp.allow\_credentials = ‘True’

c.KernelGatewayApp.allow\_methods = ‘GET,POST,PUT,DELETE,OPTIONS’

c.KernelGatewayApp.allow\_origin\_pat = r"^(https?://)?(null|shakhbanov\.org|www\.shakhbanov\.org|python\.shakhbanov\.org|www\.python\.shakhbanov\.org)$"

c.KernelGatewayApp.allow\_stdin = ‘True’

c.KernelGatewayApp.api = ‘kernel\_gateway.jupyter\_websocket’

c.KernelGatewayApp.ip = ‘0.0.0.0’

c.KernelGatewayApp.port = 8888

c.KernelGatewayApp.log\_level = ‘DEBUG’

c.KernelGatewayApp.kernel\_manager\_class.kernel\_args = [‘–ipython-dir=/tmp/ipython’, ‘–log-level=DEBUG’]
