Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Storage Quota Exceeded: 'setItem' Failure on 'chat-next-web-store' #3994

Closed
3 tasks done
lvguanjun opened this issue Feb 4, 2024 · 19 comments
Closed
3 tasks done

Comments

@lvguanjun
Copy link

lvguanjun commented Feb 4, 2024

为了提高交流效率,我们设立了官方 QQ 群和 QQ 频道,如果你在使用或者搭建过程中遇到了任何问题,请先第一时间加群或者频道咨询解决,除非是可以稳定复现的 Bug 或者较为有创意的功能建议,否则请不要随意往 Issue 区发送低质无意义帖子。

点击加入官方群聊

反馈须知

⚠️ 注意:不遵循此模板的任何帖子都会被立即关闭,如果没有提供下方的信息,我们无法定位你的问题。

请在下方中括号内输入 x 来表示你已经知晓相关内容。

  • 我确认已经在 常见问题 中搜索了此次反馈的问题,没有找到解答;
  • 我确认已经在 Issues 列表(包括已经 Close 的)中搜索了此次反馈的问题,没有找到解答。
    曾经存在一个性能相关的 issue#2393 ,压测时曾发生过,现在我是真的发生了。
  • 我确认已经在 Vercel 使用教程 中搜索了此次反馈的问题,没有找到解答。

描述问题

当我的本地存储的聊天记录足够多时,将会报错 Failed to execute 'setItem' on 'Storage': Setting the value of 'chat-next-web-store' exceeded the quota.

如何复现

本地存储有足够多的聊天记录

截图

image

一些必要的信息

  • 系统:win11
  • 浏览器: Edge
  • 版本:commit id:4511aa4d21eda4e6e0b5130d1e3222bb30734672
  • 部署方式:docker 部署
@lvguanjun lvguanjun changed the title [Bug] "Storage Quota Exceeded: 'setItem' Failure on 'chat-next-web-store'" [Bug] Storage Quota Exceeded: 'setItem' Failure on 'chat-next-web-store' Feb 4, 2024
@lvguanjun
Copy link
Author

lvguanjun commented Feb 4, 2024

可能不只是 聊天记录 导致的 local storage 不足,还存在大量的(400+)不明意义的值为空的 key

image

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


It may not only be insufficient local storage caused by chat history, but also a large number of keys with unknown meanings.

image

@fred-bf
Copy link
Contributor

fred-bf commented Feb 4, 2024

@lvguanjun could you using the follow script in chrome console to retrieve the storage usage by key?

the key start with unfinish-input should have empty value, there is a high probability that the root cause is too many message records.

// Iterate over the local storage keys and log the key and its size
Object.entries(localStorage).forEach(([key, value]) => {
  console.log(key, value.length);
});

@lvguanjun
Copy link
Author

Sure, but before this (before your reply), I have already used a script to delete keys starting with unfinish-input that have empty values, totaling 400 keys.

This is a screenshot of the storage space for each key.

image

@H0llyW00dzZ
Copy link
Contributor

It seems that a bug is being caused by unfinished input continually overwriting when the chat is switched.

@lvguanjun
Copy link
Author

So far it looks like it is, but I'm not sure that even if I remove the empty key every time, as the chat-next-web-store records continue to grow, it will still hit the limit and report an error

@lvguanjun
Copy link
Author

And how do you plan to solve the problem of the large number of null keys that already exist, either by adding them to the front-end code and deleting them every time, or by users manually executing scripts to delete them

@fred-bf
Copy link
Contributor

fred-bf commented Feb 5, 2024

@lvguanjun The unfinish-input itself shouldn't take up much space, currently the messages completely stored in local storage which cannot fundamentally solve this problem. In the future, we will consider supporting server-side storage to fundamentally solve this issue, but it will require more time.

@lvguanjun
Copy link
Author

I'm not sure if these options are feasible, but from my personal use, I tend to prefer chat logs to be stored locally, thanks

image

@H0llyW00dzZ
Copy link
Contributor

I'm not sure if these options are feasible, but from my personal use, I tend to prefer chat logs to be stored locally, thanks

image

It's challenging and costly (e.g, you have to spent money more) because it's an interpreted language that runs on a browser, unlike compiled languages. For instance, Go can be stored locally with ease, such as directly storing it in memory.

@H0llyW00dzZ
Copy link
Contributor

Anyways As of now, there's no solution to fix it. In the future, I might consider try rewriting it in Go + WASM instead of solely in Rust. This is because Go offers simplicity and cost-effectiveness especially for personal/home use

@lvguanjun
Copy link
Author

Okay, thanks for the replies, it's up to you to close the issue or not.

I might export the chat history, then clear the local storage to temporarily circumvent this issue.

@H0llyW00dzZ
Copy link
Contributor

Okay, thanks for the replies, it's up to you to close the issue or not.

I might export the chat history, then clear the local storage to temporarily circumvent this issue.

alternative this free if you want stored locally

https://github.com/seaweedfs/seaweedfs

@H0llyW00dzZ
Copy link
Contributor

@lvguanjun it fix now

should be good from stupid complexity front end

Untitled.video.-.Made.with.Clipchamp.16.mp4

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


@lvguanjun it fix now

should be good from stupid complexity front end

Untitled.video.-.Made.with.Clipchamp.16.mp4

@lvguanjun
Copy link
Author

Get, thanks, if I understand the video correctly, this fix also removes the unfinish-input key that was generated earlier.

@H0llyW00dzZ
Copy link
Contributor

Get, thanks, if I understand the video correctly, this fix also removes the unfinish-input key that was generated earlier.

correct

@H0llyW00dzZ
Copy link
Contributor

可能不只是 聊天记录 导致的 local storage 不足,还存在大量的(400+)不明意义的值为空的 key

image

it remove this one

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


It may not only be the lack of local storage caused by chat records, but also a large number (400+) of empty keys with unknown meanings.

![image](https://private-user-images.githubusercontent.com/58430934/302108482-2cc8bc39-6b68-4f0e-a7a5-4d751e80558b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOi JnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDcxNDg1ODAsIm5iZiI6MTcwNzE0ODI4MCwicGF0aCI6Ii81ODQzMDkzNC8zMDIxMD g0ODItMmNjOGJjMzktNmI2OC00ZjBlLWE3YTUtNGQ3NTFlODA1NThiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAy NDAyMDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjA1VDE1NTEyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg1YmY2ZDBmM2QzMTk1Nz E4Njg3MmY4Y2IzOWRlZjQxMGFkYjA1NjBjNjNjYzYzNWUwMGMyMTU0NGE0OWE4OTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.vHbQ dHTzFAGHGfBuvxQQiaX9sfqXfssCpeYCFEQkDqo)

remove this one

@fred-bf fred-bf closed this as completed Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants