ucall: Bug: Cannot call the server

Describe the bug

After creating a custom server in python using ujrpc and starting the server, on sending a request server terminates.

This also happens while using examples/sum/ujrpc_server.py directly from inside the codebase.

SERVER: ujrpc-server

CLIENT (cURL): ujrpc-curl

Tried sending request using cURL, Postman with & without any data.

However, running the benchmarks run successfully. ujrpc-benchmark

Steps to reproduce

System: W11, WSL2 Python 3.10.6 pip 23.0.1 virtualenv 20.20.0

  1. Clone the project
  2. Create a virtual environment & source it
  3. install all required packages pip install uvicorn fastapi websocket-client requests tqdm fire
  4. run the server python examples/sum/ujrpc_server.py
  5. request using cURL or Postman

Expected behavior

  1. Calling with / without data should not terminate the server
  2. Calling with proper data & method should return valid data

UJRPC version

0.0.9

Operating System

W11-WSL2-Ubuntu22.04

Hardware architecture

x86

Which interface are you using?

Official Python bindings

Which implementation are you using?

POSIX

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project’s Code of Conduct

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 22 (4 by maintainers)

Most upvoted comments

Also, slight correction to the cURL request. It was missing a } in the data portion.

thanks @biplobmanna ^^ I was a bit blind. That fixes it.

@ashvardanian you were interested in benchmarks. If you have some commands you’d like me to run, please let me know.

As we have not tested on WSL, it is difficult to predict what issues may arise. @biplobmanna it would be better to open a separate feature request specifically for WSL. Similarly, if @thomanq encounters any other reproducible issues, new issues should be opened accordingly.

However, it appears that the specific issue related to Illegal instruction (core dumped) has been resolved, so i guess this issue can be closed @ashvardanian.

Trying with ujrpc.uring:

I’m getting segfaults for every case.

Killed all processes previously exited -> still segfault. Restarted WSL and redo -> still segfault max_threads=8 -> still segfault max_threads=1 -> still segfault

Maybe this issue is with WSL? 🤔

Also, slight correction to the cURL request. It was missing a } in the data portion.

curl -X POST  -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"sum","params":{"a":2,"b":3}}' http://localhost:8545/

I generally use Postman for these, and here’s the full cURL for that (if it helps):

curl --location 'http://localhost:8545' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc":"2.0",
    "id": 1,
    "method":"sum",
    "params": {
        "a": 2,
        "b": 3
    }
}'

Thank you, @thomanq! We will follow up soon.


As for the endpoint, it will remain http://localhost:8545/ for all endpoints. Unlike REST, with JSON-RPC, the function name and arguments are always provided in the payload, and not in the URI.

Using that code from the README:

from ujrpc.posix import Server
# from ujrpc.uring import Server # on 5.19+
server = Server()

@server
def sum(a: int, b: int):
    return a + b

server.run()

I still get:

Initialized server: 0.0.0.0:8545
- 1 threads
- 1 max concurrent connections
Illegal instruction (core dumped)

when visiting http://localhost:8545/. I guess it should be a 404? Same issue visiting http://localhost:8545/sum or http://localhost:8545/sum?a=1&b=2

I reinstalled with the above command.

$ pip show ujrpc
Name: ujrpc
Version: 0.2.7

Trying to use ujrpc.uring I get a ModuleNotFoundError. Not sure what I’d have to do to test that.

from ujrpc.uring import Server # on 5.19+
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'ujrpc.uring'
$ pip freeze
numpy==1.24.2
Pillow==9.4.0
ujrpc==0.2.7

The error message Illegal instruction (core dumped) was coming from simdjson. We upgraded to the latest version, and it appears that the issue has been resolved. I suggest that you try again after the new version is released and see if the problem is resolved on your end.

I also get Illegal instruction (core dumped). CPU: AMD Ryzen 7 4800U Kernel: Linux 6.2 Python 3.11.0 implementation: Posix ujrpc 0.2.3

Thanks for reporting! The benchmark and the server you are trying to run are unrelated to each other, but that is not the issue. Apparently, you are using an old CPU, and one of the SIMD-accelerated libraries uses an instruction not present in your ISA. Which generation/model CPU are you using?

CPU: Intel i5 8250U
OS: W11 build 22621