# \[Solution Found\] Using Ray's debugger on Windows

**URL:** https://discuss.ray.io/t/solution-found-using-rays-debugger-on-windows/14474
**Category:** Dashboard, Monitoring & Debugging
**Created:** [April 22, 2024, 9:25am UTC](https://discuss.ray.io/t/solution-found-using-rays-debugger-on-windows/14474 "2024-04-22T09:25:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jiangpeng\_li](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/jiangpeng_li/32/5908_2.png) [@jiangpeng\_li](https://discuss.ray.io/u/jiangpeng_li)
#### Post date: [April 22, 2024, 9:25am UTC](https://discuss.ray.io/t/solution-found-using-rays-debugger-on-windows/14474/1 "2024-04-22T09:25:51Z")

</div>

**How severe does this issue affect your experience of using Ray?**

- Medium: It contributes to significant difficulty to complete my task, but I can work around it.

**Problem Description:**

I use the Windows system. According to the [tutorial](https://docs.ray.io/en/latest/ray-observability/user-guides/debug-apps/ray-debugging.html), after I added `breakpoint()` in my code, I typed `ray debug` in my terminal and then selected the corresponding breakpoint’s index (for instance “0”). Then, I will get an error with the message:

```auto
  File "D:\Anaconda\envs\XXXX\lib\site-packages\ray\util\rpdb.py", line 346, in _connect_pdb_client
    read_sockets, write_sockets, error_sockets = select.select(
OSError: [WinError 10038] An operation was attempted on something that is not a socket

```

**Solution:**

According to a hint I got from this [answer](https://github.com/xysun/pychat/issues/5#issuecomment-405634174), I found how to fix it:

You should change the `_connect_pdb_client(host, port)` function at line 340 in `ray.util.rpdb.py` to:

```auto
def _connect_pdb_client(host, port):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((host, port))
    import msvcrt

    while True:
        # Get the list of sockets which are readable.
        ready_to_read = select.select([s], [], [], 1)[0] # Added code
        if msvcrt.kbhit(): ready_to_read.append(sys.stdin) # Added code

        # for sock in read_sockets:
        for sock in ready_to_read: # Changed code
            if sock == s:
                # Incoming message from remote debugger.
                data = sock.recv(4096)
                if not data:
                    return
                else:
                    sys.stdout.write(data.decode())
                    sys.stdout.flush()
            else:
                # User entered a message.
                msg = sys.stdin.readline()
                s.send(msg.encode())

```

I think maybe the support of using Debugger on the Windows system can be added. Or maybe “without modifying the source code, the Debugger only supports Linux systems” can be mentioned in the documentation.

Just a small piece of advice. Thank you for your development of this fantastic project.

Best regards,

JL

---

<div class="post-metadata">

### Author: ![Huaiwei\_Sun](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/huaiwei_sun/32/1316_2.png) [@Huaiwei\_Sun](https://discuss.ray.io/u/Huaiwei_Sun)
#### Post date: [April 22, 2024, 4:26pm UTC](https://discuss.ray.io/t/solution-found-using-rays-debugger-on-windows/14474/2 "2024-04-22T16:26:53Z")

</div>

thx. filed an issue: [[Observability / Doc] Add support of ray debugger on windows · Issue #44902 · ray-project/ray · GitHub](https://github.com/ray-project/ray/issues/44902)

---

<div class="post-metadata">

### Author: ![jiangpeng\_li](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/jiangpeng_li/32/5908_2.png) [@jiangpeng\_li](https://discuss.ray.io/u/jiangpeng_li)
#### Post date: [April 23, 2024, 1:28am UTC](https://discuss.ray.io/t/solution-found-using-rays-debugger-on-windows/14474/3 "2024-04-23T01:28:18Z")

</div>

Thank you for your attention to this matter.

---

<div class="post-metadata">

### Author: ![Sam\_Chan](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sam_chan/32/5011_2.png) [@Sam\_Chan](https://discuss.ray.io/u/Sam_Chan)
#### Post date: [April 25, 2024, 1:47am UTC](https://discuss.ray.io/t/solution-found-using-rays-debugger-on-windows/14474/4 "2024-04-25T01:47:46Z")

</div>

Thanks both - let’s follow up on GH \> brought up in discussion with mattip@ on the repo as well. Stay tuned; we’ll probably have Mattip working on a fix…
