-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Description
Version of ton-http-api: v2.0.57
Version of ton (liteserver): v2025.07
When Smart contract address is sent in /getTokenData, the Exception: Smart contract is not Jetton or NFT occurs as the example shown below.
curl --location -v 'http://localhost:8080/getTokenData?address=EQC6Ks9NSTfDrMH0lPQbYww1s5tlM94458k5PPZRBl%2B%2FOZ5f'
# In ton-http-api log
2025-10-01 11:52:54.494 | WARNING | pyTON.worker:process_task:160 - TonlibWorker #000 raised exception of type Exception while executing task. Method: get_token_data, args: ('EQC6Ks9NSTfDrMH0lPQbYww1s5tlM94458k5PPZRBl+/OZ5f',), kwargs: {}, exception: Smart contract is not Jetton or NFT
2025-10-01 11:52:54.495 | INFO | pyTON.manager:log_liteserver_task:155 - Received result of type: NoneType, method: get_token_data, task_id: 1759319574.4629445:0.423632250643883
[2025-10-01 11:52:54 +0000] [360] [ERROR] Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/h11_impl.py", line 366, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/fastapi/applications.py", line 290, in __call__
await super().__call__(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/applications.py", line 122, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.10/dist-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
raise e
File "/usr/local/lib/python3.10/dist-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 66, in app
response = await func(request)
File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 241, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 167, in run_endpoint_function
return await dependant.call(**values)
File "/app/pyTON/main.py", line 754, in jsonrpc_handler
result = await handler(**params)
File "/app/pyTON/main.py", line 195, in wrapper
result = await asyncio.wait_for(func(*args, **kwargs), settings.tonlib.request_timeout)
File "/usr/lib/python3.10/asyncio/tasks.py", line 445, in wait_for
return fut.result()
File "/app/pyTON/main.py", line 512, in get_token_data
return await tonlib.get_token_data(address)
File "/app/pyTON/manager.py", line 334, in get_token_data
return await self.dispatch_request('get_token_data', address)
File "/app/pyTON/manager.py", line 280, in dispatch_request_to_worker
await self.futures[task_id]
Exception: Smart contract is not Jetton or NFT
It seems that the exception is not caught properly, which forces the gunicorn worker to exit. The worker on the gunicorn server may serve many requests at the same time, and the forced exit causes EOF or connection reset by peer error on the client sending the requests.
Below is the command and some envs used by the ton-http-api container.
command: -c "gunicorn -k uvicorn.workers.UvicornWorker -w 32 --bind 0.0.0.0:8080 pyTON.main:app"
environment:
- TON_API_GET_METHODS_ENABLED=1
- TON_API_JSON_RPC_ENABLED=1
- TON_API_WEBSERVERS_WORKERS=32
- TON_API_TONLIB_PARALLEL_REQUESTS_PER_LITESERVER=100
- TON_API_TONLIB_REQUEST_TIMEOUT=30
- TON_API_CACHE_ENABLED=0
# ...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels