Jump to content
thetuningspoon

Strange errors following upgrade

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?

Share this post


Link to post
Share on other sites

It's an error that prevents saving of data to the database with the same unique field, e.g. same id. So it's most likely a pagefield or something else which is multi value. Also check your modules if they could be the issue.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

http404 doesn't necessarely mean it was on 404.

Guest because it is triggered by a visitor. But can be amything. A cron script or a template or module.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Can the '41-0' provide me with any clue towards debugging this? If that is a pointer to an entry in the database, I could look it up in the database. I'm just not sure how that number maps to entries.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks for the ->save() tip. I'll see what I can find. I was hoping there was some way to tell what table or row the error pertained to.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

i am having the same issue on the 3.0.62 version. i disabled system notifications module, but it doesn't seem to be helping

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

@Peter Knight Do you have the System Notifications module installed? As far as I know the module cannot be uninstalled so you need to live with this error. I have it too and I also get the message from time to time, however it seems to be "harmless".

 

  • Like 1

Share this post


Link to post
Share on other sites
18 minutes ago, szabesz said:

As far as I know the module cannot be uninstalled

It can be if you persist hard enough with DB modifications and other trickery, but that module is the devil incarnate for sure 🙂

 

  • Like 1
  • Haha 1

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Having this same issue and I'm running System Notifications module, shame, as I hoped the module would be really useful but is mostly a desaster.

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...