Failed persist error and slow file upload speed in browser (TDLib 1.8.5, Chrome 136)
Hello!
I'm using TDLib 1.8.5, built by myself for the browser environment (Chrome 136.0.7103.113). File upload generally works, but I have two issues:
- Error on file upload completion When uploading a file (for example, FORTUNE.mp3), I consistently see this error in the browser console at the end of the upload:
text Failed persist /tdlib/outboundfs/1/FORTUNE.mp3 ErrnoError {node: undefined, errno: 63, message: 'FS error', stack: '<generic error, no stack>', setErrno: ƒ} Despite this error, the file is still delivered to the Telegram chat.
- File upload speed is much lower than in the official Telegram app Uploading the same file in the official Telegram app is significantly faster than in my web client using TDLib/tdweb. The speed difference is substantial.
My code for sending a file:
<template>
<section>
<QRCodeStylingComponent :link='authorizationState?.link' />
<input type='file' @change='uploadFile'>
</section>
</template>
<script setup lang='ts'>
import { ref } from 'vue';
import QRCodeStylingComponent from '@/components/QRCodeStyling.vue';
import { getBrowser } from './Utils/Common';
import TdClient from 'tdweb/dist/tdweb.js';
const TdLibController = new TdClient({
jsLogVerbosityLevel: 1,
})
TdLibController.onUpdate = (update) => {
switch (update['@type']) {
case 'updateAuthorizationState': {
authorizationState.value = update.authorization_state;
switch (update.authorization_state['@type']) {
case 'authorizationStateWaitTdlibParameters':
TdLibController.send({
'@type': 'setTdlibParameters',
use_test_dc: false,
api_id: 'API_ID',
api_hash: 'API_HASH',
system_language_code: navigator.language || 'en',
device_model: getBrowser(),
application_version: '1.0.0',
database_directory: 'tdlib',
use_file_database: false,
use_chat_info_database: false,
use_message_database: false,
use_secret_chats: false,
});
break;
case 'authorizationStateWaitEncryptionKey':
TdLibController.send({ '@type': 'checkDatabaseEncryptionKey' });
break;
case 'authorizationStateWaitPhoneNumber':
TdLibController.send({
'@type': 'requestQrCodeAuthentication',
other_user_ids: []
});
break;
default:
break;
}
break;
}
case 'updateFile':
console.log((update.file.remote.uploaded_size / update.file.size) * 100);
default:
break;
}
}
const authorizationState = ref()
const uploadFile = async (event: Event) => {
await TdLibController.send({
'@type': 'getChats',
chat_list: { '@type': 'chatListMain' },
limit: 1000
});
const target = event.target as HTMLInputElement;
const file = target.files?.[0];
if (!file) {
return;
}
TdLibController.send({
'@type': 'sendMessage',
chat_id: 6727905301,
input_message_content: {
'@type': 'inputMessageDocument',
disable_content_type_detection: true,
document: {
'@type': 'inputFileBlob',
name: file.name,
data: file
},
thumbnail: null,
}
});
console.log('file sent to chat');
};
</script>
Questions:
What causes the Failed persist ... ErrnoError { errno: 63, message: 'FS error' } error at the end of file upload?
Is there a way to avoid this error, or is it safe to ignore?
Why is the file upload speed in the browser much slower than in the official Telegram app?
Are there any recommendations to improve upload performance in the browser?
Environment:
TDLib version: 1.8.5
Browser: Chrome 136.0.7103.113
Thank you!
The error means that persisting of the file in indexedDB has failed. Likely, there is not enough disk space, or browser quota was exceeded. The file will be downloaded from the server next time it is needed.
File upload speed depends on the browser network handling, but it shouldn't be much slower then in regular environment. At the worst case it should be a few times slower, but even this is unlikely.
Regarding the "Failed persist" issue, as I understand it, it doesn’t really affect anything, so there’s no need to worry about it. What concerns me much more is the speed and stability of file uploads. For some reason, when I upload a file, everything works fine until the progress reaches over 90%. After that, it starts to slow down or freeze, and I have to wait 10–20 seconds for the remaining percentage to finish uploading and for the message to be sent to the chat. In the official app, this doesn’t happen—everything uploads smoothly. Probably it's because of reconnects?
And one more thing: I tested file uploads on a high-speed connection (about 500 Mbps), but according to my system monitor, the upload speed is limited to around 200 Mbps. In the official application, there are no such limits.
[ 3][t 0][1750276164.009000062][MessagesManager.cpp:28560][!MessagesManager] Receive send_chat_action timeout in chat 6727905301
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276164.009000062][MultiTimeout.cpp:38][!MessagesManager] Add PendingSendDialogActionTimeout for 6727905301 in 4.000000
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276164.009000062][MultiTimeout.cpp:84][!MessagesManager] Set timeout of PendingSendDialogActionTimeout in 3.999800
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276164.009999990][MessagesManager.cpp:29308][!MessagesManager] Search for yet unsent message 224.1 in chat 6727905301 found 0x9eefd8
1.485b375002986efd1f9f.worker.js:2585 [ 3][t 0][1750276164.009999990][MessagesManager.cpp:28616][!MessagesManager] Send ChatActionUploadingDocumentAction(82%) in chat 6727905301
1.485b375002986efd1f9f.worker.js:2585 [ 3][t 0][1750276164.009999990][DialogActionManager.cpp:338][!MessagesManager] Skip unneeded ChatActionUploadingDocumentAction(82%) in chat 6727905301
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276164.009999990][BufferedFd.h:140][!Session:2:main] Nothing to write to [fd:10]
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276164.011000156][SessionConnection.cpp:1140][!Session:2:main] Last pong was in 0.164800/0.164800, last read was in 0.165300/0.165300, RTT = 2.000000, ping timeout = 139.446382, read timeout = 139.446382, flush packet in 29.835200, wakeup in 29.835200
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276164.011000156][BufferedFd.h:140][!Session:2:upload#0] Nothing to write to [fd:11]
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276164.011000156][SessionConnection.cpp:1140][!Session:2:upload#0] Last pong was in 23.761900/23.761900, last read was in 23.762200/23.762200, RTT = 2.000000, ping timeout = 136.030506, read timeout = 136.030506, flush packet in 6.238100, wakeup in 6.238100
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276164.011000156][BufferedFd.h:140][!Session:2:upload#3] Nothing to write to [fd:12]
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276164.012000083][SessionConnection.cpp:1140][!Session:2:upload#3] Last pong was in 23.531200/23.531200, last read was in 23.531500/23.531500, RTT = 2.000000, ping timeout = 135.398631, read timeout = 135.398631, flush packet in 6.468800, wakeup in 6.468800
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276164.012000083][BufferedFd.h:140][!Session:2:upload#2] Nothing to write to [fd:13]
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276164.012000083][SessionConnection.cpp:1140][!Session:2:upload#2] Last pong was in 23.247300/23.247300, last read was in 23.247600/23.247600, RTT = 2.000000, ping timeout = 137.670995, read timeout = 137.670995, flush packet in 6.752700, wakeup in 6.752700
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276164.012000083][BufferedFd.h:140][!Session:2:upload#1] Nothing to write to [fd:14]
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276164.012000083][SessionConnection.cpp:1140][!Session:2:upload#1] Last pong was in 22.867400/22.867400, last read was in 22.867600/22.867600, RTT = 2.000000, ping timeout = 139.363707, read timeout = 139.363707, flush packet in 7.132600, wakeup in 7.132600
485b375002986efd1f9f.worker.js:3831 Scheduler receive in 3.9964999999999975s 485b375002986efd1f9f.worker.js:3831 Scheduler receive in 0.001s 1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276167.612000226][BufferedFd.h:206][!Session:2:main] Flush read: +108B[total:108B]
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276167.612000226][AuthData.cpp:155][!Session:2:main] Receive packet in message 0x68531847a140f801 from session 6256020493575958661 at 99.276600
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276167.613000154][BufferedFd.h:140][!Session:2:main] Nothing to write to [fd:10]
1.485b375002986efd1f9f.worker.js:2585 [ 4][t 0][1750276167.613000154][SessionConnection.cpp:1140][!Session:2:main] Last pong was in 0.000400/0.000400, last read was in 0.001000/0.001000, RTT = 2.000000, ping timeout = 139.446382, read timeout = 139.446382, flush packet in 26.232700, wakeup in 26.232700