ton-blockchain / ton

Main TON monorepo
Other
3.07k stars 970 forks source link

tonlibjson: segmentation fault (core dumped) #1128

Closed lapismyt closed 2 months ago

lapismyt commented 2 months ago

Segmentation fault using tonlibjson

I'm using pytonlib and when I tried to use this code:

from pytonlib import TonlibClient
import asyncio
import json
import requests
from pathlib import Path
async def main():
    config = requests.get('https://ton.org/testnet-global.config.json').json()
    Path('/tmp/tonlib_keystore').mkdir(parents=True, exist_ok=True)
    client = TonlibClient(2, config, '/tmp/tonlib_keystore')
    await client.init()

asyncio.run(main())

I'm getting Tonlib #002 crashed

Expected behaviour: just created working TonlibClient

Actual behaviour: Tonlib #002 crashed

And Segmentation fault (core dumped) when I directly download and run tonlibjson from this link: https://github.com/ton-blockchain/ton/releases/download/v2024.08/tonlibjson-linux-x86_64.so

Same wih compiled on my device tonlibjson using this guide: https://docs.ton.org/develop/howto/compile

Steps to reproduce:

Install python 3.10 and pytonlib run code above

or

Download tonlibjson: https://github.com/ton-blockchain/ton/releases/download/v2024.08/tonlibjson-linux-x86_64.so Run chmod +x tonlibjson-linux-x86_64.so Run ./tonlibjson-linux-x86-64.so

or

Compile tonlibjson: https://docs.ton.org/develop/howto/compile Run ./libtonlibjson.so.0.5

Get error

TON Version: v2024.8, tried tonlibjson from Releases and compiled on my device

I'm using Ubuntu 24.04 with Intel Core i7-2600, also tried on VPS with Debian 12 and Ubuntu 22.04 (unknown CPU)

lapismyt commented 2 months ago

Sorry for inconvenience, I just tried use pytonlib with cdll_path={tonlibjson_path} and all's working!