nodegin / tglib

TDLib (Telegram Database library) bindings for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segmentation fault on "this.tdlib.td_json_client_receive.async"

panda2048 opened this issue · comments

I just get the td lib built and trying on the sample
But I got segmentation fault even if I only new Client as below

const client = new Client({
apiId: 'YOUR_API_ID',
apiHash: 'YOUR_API_HASH',
phoneNumber: 'YOUR_PHONE_NUMBER',
})

And I go in the src and add some log to troubleshoot
I found that it is crashed after a few run of _recieve and end up in this.tdlib.td_json_client_receive.async
Is there any clue of how to resolve this issue?

_receive(timeout = 10) {
return new Promise((resolve, reject) => {
if (!this.client) {
return reject(new ClientNotCreatedError)
}
console.log(10)
this.tdlib.td_json_client_receive.async(this.client, timeout, (err, response) => {
console.log(11)
if (err) {
console.log(12)
return reject(err)
}
console.log(13)
if (!response) {
return resolve(null)
}
console.log(14)
resolve(JSON.parse(response))
})
})
}

What Node.js version you currently using?

Also, please provide what OS, version you try to run with.

I am running node 10.1 in linux (Amazon aws)

Btw, I am doing some troubleshoot too
It crashed after “authorizationStateWaitEncryptionKey”
Seems it never goes into state for Auth code, etc

Some logs I added in Client.js to show where it dies below

loop updateAuthorizationState
auth: authorizationStateWaitTdlibParameters
loop updateAuthorizationState
auth: authorizationStateWaitEncryptionKey
loop ok
Segmentation fault

Have you try other libraries in Node.js or other programming languages?

It looks the TDLib is not ready for Linux.. I think you need to open an issue in tdlib/td

There is tg_cli (executable) in the tdlib build
But it is working fine

I tried another lib before but that seems to be outdated And missing message from channels

@panda2048 What it prints with verbosityLevel 10?

@Bannerets I changed verbosityLevel to 10 inside Client.js but nothing new are printed
Am I changing it in the right place?

@panda2048 You can change verbosityLevel in options:

const client = new Client({
  apiId: 'YOUR_API_ID',
  apiHash: 'YOUR_API_HASH',
  phoneNumber: 'YOUR_PHONE_NUMBER',
  verbosityLevel: 10,
})

@Bannerets still the same, no other message other than segmentation fault

@panda2048 Please check the logs.txt located in __tglib__ for version 1.3 or above, otherwise check _td_logs.txt for logs.

The TDlib messages are saved in separate text file and not displayed on console directly in order to avoid the pollution.