Error 1062 at some times in database system

Asked

Viewed 330 times

0

I am facing the following error while running my app:

Error Number: 1062 Duplicate entry '1484918130' for key 'PRIMARY' INSERT INTO sistema_session (id, ip_address, timestamp, data) VALUES ('5bb80caf2df687b3d36def267b95400f82e209b1', '200.103.171.165', 1484918130, '__ci_last_regenerate|i:1484918130;Identity|s:19: "[email protected] ";email|s:19: "[email protected] ";user_id|s:2: "24 ";old_last_login|s:10: "1484917031 ";username|s:8: "Jeronimo ";id_empresa|s:2: "14 ";typMenu|s:1: "1 ";') Filename: Libraries/Session/drivers/Session_database_driver.php Line Number: 233

I’m using Codeigniter, CI Session and I’m using Ionauth.

I have other systems using the same structure and does not present this error.

Someone’s been through it?

  • Your fault is not in the session, is in the bank. The timestamp is the primary key, cannot be repeated. What bank is this?

  • I am using mysql

  • If there’s a function creating this data to enter into the database, it’s better to show. Error indicates that vc is trying to pass repeated values to a primary key of the bank.

  • More how can I fix this because I haven’t changed anything in the ionauth library

  • If the library is generating this data with this failure, then you have two options: either study the documentation more deeply and find a way to prevent this from happening, or abandon the use of this library. In particular, I’ve never found anyone complaining about it, including, there’s a lot of material teaching to use (see).

  • I use the same library on another server and it works perfectly.

  • A guess: the library seems to use timestamp to generate the keys. The fact is that the generated timestams are repeating from time to time. This is a symptom of wrong time on the server. Understand: if the server does not have a setting that adjusts the time, it may be passing wrong timestamp to the library, and it is repeating the timestamp and trying to write to the database, which returns its error.

  • 1

    Try to synchronize your server clock and make the date always correct to avoid these things (NTP help). Another advice would be to define the Default timezone PHP (what can be done with date_default_timezone_set()).

Show 3 more comments

1 answer

0


I solved the problem by downloading a more current version of plugins.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.