Jump to content

Strange errors following upgrade


thetuningspoon

Recommended Posts

I recently upgraded a few of my older ProcessWire sites to 2.5.23. Soon thereafter I've been getting the following error report sent to me from several of the sites:

Page: .../http404/

User: guest

Exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '41-0' for key 'PRIMARY' (in .../wire/core/FieldtypeMulti.php line 261)

I can't seem to replicate the issue, and I'm not even sure where it's happening because reportedly it is happening on the 404 page?

Any ideas?

Link to comment
Share on other sites

Why would this be triggered by a guest on the site, though? I don't recall any of these sites saving or creating fields or pages from within templates.

Edit: I also know for certain that at least one of them didn't have any changes made on the backend by the client during this time, either.

Link to comment
Share on other sites

One thing to always keep in mind, if you are on a shared hosting plan, your website can get probed by other users that share the same server you are hosted on.  You can also get probed by bots and other scripts running on that server.

Link to comment
Share on other sites

It's like it's mentioned in the error message. There's already an entry with the primary key 41-0 in any of your tables and some code is trying to save another entry with this primary key to this exact same table. For me this error was most of the time caused by (own) modules, which did stuff they weren't supposed to do. But basically you could also just search your site folder for "->save(" as this is the part which will result in the error. 

  • Like 2
Link to comment
Share on other sites

FYI, I routinely use Piwik for my web analytics on all my websites and any client's properties that I maintain.  I can usually correlate the errors you are referring about to guest activity (i.e. unknown individuals or bots).  If it's related to my own activity, I can look at the page affected (Piwik gives me this information) and then troubleshoot what PW template is associated with the problem (page).  I'm quite sure there are other ways of tracking down this information, however that has worked for me.

What I'm glad about is that PW gives up the error for me to troubleshoot.  

  • Like 1
Link to comment
Share on other sites

FieldtypeMulti hints to fields like a image, comments or pagetable field.

The http404 hints at it's either the 404 page. Or a URL that is called that doesn't exist and that renders the 404 page but I'm not sure if that would result in a /http404/ (but could be).

I have had errors shown and searched for hours until I realized it's a $page->render() I use in templates and the path the error logs was the url of the rendered page (partial) and not the viewed page.

Or it's a export or import script (cron script) or bootstrap script. I think those also would end in a /http404/ as I had lots of these in the past.

It might be a page name "41-0" in "pages" table. But since that not a PRIMARY it might be a language name field like "name1038" where 1038 would be the language id.

See if you can find a page with that name maybe it's in any of the fields.

Does it happen frequently, how many times, when. What modules have you installed. What fields. All might be a hint at where to look for.

  • Like 1
Link to comment
Share on other sites

Strange is that:

- Duplicate entry '41-0' for key 'PRIMARY' -

Doesn't look like "pages" db table. Its primary key is "id" and that can't be "41-0". So I'm not sure. There's also indexes for parent_id and page_id maybe it's one of those. But then 41 would be "admin" and not guest.  I got lot's of these when doing multilanguage back then when it was relatively new and had some bugs that took a while to get me into.

/http404/ and "guest" definately hints at a script or module that is run via a layzcron or real cron, in a template etc. Sure a search for a "->save(" in your site folder might help to narrow it down.

Link to comment
Share on other sites

  • 4 weeks later...

Still getting this on about 6 of my upgraded sites and am still at a loss. I disabled all 3rd party modules on one of the sites. No crons or lazy crons running... and I'm still getting the errors! I get them at least once a week, often a group of them every couple days or so, but no visible regularity to which sites they come from. Quite vexing.

Link to comment
Share on other sites

  • 1 month later...

Okay, I think I've FINALLY narrowed this down to an issue with the new System Notifications module, which I have enabled on all of these sites. I disabled it on one of the sites and have not seen any errors from it since. It is the only module that uses FieldtypeMulti that is shared by all of the sites that are reporting the issue, and it is of course something that has changed/been added since 2.5.

Link to comment
Share on other sites

  • 3 weeks later...

Hello,

I'm getting this exact error after launching a site using 2.6.1 for the first time.

I ran the site through Xenu link checker to try and trigger the error message, but it ran fine, suggesting to me that the problem doesn't lie in the site templates.

The System Notifications module appears to create a table in the database called field_notifications, which holds the data that is used for the notifications.

It would appear that the error is being caused by a 404 error trying to be added to this table without a unique pages_id and sort. 41 is the superuser ID I believe. So essentially what is happening is the system is trying to add another record (pages_id = 41, sort = 0) when it already exists. However, I can't seem to replicate this however many times I generate a 404!

Any ideas what might be generating the 404 that is causing the error?

(PS - Going to disable the 404 notifications for the time being)

  • Like 3
Link to comment
Share on other sites

  • 2 years later...
  • 1 year later...

I'm getting this too

Quote

Exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '41-0' for key 'PRIMARY' (in /var/www/vhosts/domain.com/httpdocs/wire/core/FieldtypeMulti.php line 295) 

 

I have notifications turned on too. I wonder has @ryan any advice here if it is notifications. It's hard to replicate.

Link to comment
Share on other sites

This comes up time and again, usually harmless, but what's now happened three times (on two different sites) is that at the same time this error pops up, something happens to the cache. The sites HTML and CSS is wiped and all you can see is the sites text content. Once the cache is wiped clean all is back to normal. Don't know if these problems are related, but the timing is peculiar. Both sites are running ProCache 3.18. and PW 3.0.98.

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...