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

Rare error when updating a word with tags #120

Open
HenryWales opened this issue Apr 28, 2023 · 3 comments
Open

Rare error when updating a word with tags #120

HenryWales opened this issue Apr 28, 2023 · 3 comments
Labels
bug Something isn't working database Database-related issues

Comments

@HenryWales
Copy link

I have edited many words with tags before first seeing this error. I don't know what can be making it happen sometimes and sometimes not. Most of the time it appears to work as expected.


Fatal Error in SQL Query: INSERT INTO tags (TgText) VALUES('some_tag')

Error Code & Message: [1062] Duplicate entry 'some_tag' for key 'TgText'

Backtrace:

#0 C:\xampp\htdocs\lwt\inc\database_connect.php(57): do_mysqli_query('INSERT INTO tag...')
#1 C:\xampp\htdocs\lwt\inc\session_utility.php(278): runsql('INSERT INTO tag...', '')
#2 C:\xampp\htdocs\lwt\edit_words.php(666): saveWordTags(7034)

This leads to some_tag being removed as a tag for the word.

@HugoFara HugoFara added bug Something isn't working database Database-related issues labels Apr 30, 2023
@HugoFara
Copy link
Owner

That's an annoying bug, I cannot reproduce it 🤔

I'm not sure of the cause, maybe your server takes too much time to store session data, so it's not detected, but that is only a theory. Maybe we can go for a small experiment. Can you replace line 273 of inc/session_utility.php:

getWordTags(1);

by this

getWordTags(1);
get_tags(1);

It will force the server to refresh all tags, it increases it's load a bit, but at least we can guaranty the we try to have the good data.

@HenryWales
Copy link
Author

The bug hasn't reproduced yet after including the change, but the bug was rare before so it's hard to tell what was happening.

@HugoFara
Copy link
Owner

HugoFara commented May 7, 2023

Okay, I think I will keep this issue open and investigate a bit further when I will find some time.

See you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working database Database-related issues
Projects
None yet
Development

No branches or pull requests

2 participants