Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am getting this error with 7.15. They are consistently happening in pairs. I'm using mysql. Note this is
php
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT savepoint_1 does not exist: ROLLBACK TO SAVEPOINT savepoint_1; Array ( ) in file_usage_add() (line 661 of /var/www/website.com/includes/file.inc).
node
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT savepoint_1 does not exist: ROLLBACK TO SAVEPOINT savepoint_1; Array ( ) in file_usage_add() (line 661 of /var/www/buyagainbaby.com/includes/file.inc).
I originally posted about this in a related thread http://drupal.org/comment/edit/6556106.
Comment | File | Size | Author |
---|
Issue fork drupal-1803886
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
tuccio CreditAttribution: tuccio commentedSimilar error here:
Comment #2
ParisLiakos CreditAttribution: ParisLiakos commentedclosed as duplicate: #1825628: PDOException 1305 SAVEPOINT savepoint_1 does not exist -- when trying to add content type
Seems #1007830: Nested transactions throw exceptions when they got out of scope didnt totally fixed this?
Comment #3
somatics CreditAttribution: somatics commentedYou closed my other ticket (referenced above) as a duplicate of this one. But you also filed this one under Drupal version 8. My site runs 7. Is the resolution to this issue going to help Drupal 7?
Comment #4
ParisLiakos CreditAttribution: ParisLiakos commentedIts resolution will have to get through drupal 8 first and then backported to drupal 7
Comment #5
somatics CreditAttribution: somatics commentedRespectfully, if this is a major bug (it is for us) in 7, isn't it important to get treated as such? I'm concerned that it will just be on a long list in developing 8, since 8 is a long way to production status, whereas in a live 7 site, it's a much more immediate priority -- for example, we can't even create new content types, which is critical for our site right now.
Comment #6
ParisLiakos CreditAttribution: ParisLiakos commentedI didnt mention that this will have to wait until drupal 8 is released.
Just that this fix will have to committed to drupal 8 repository and then drupal 7..that helps the two branches being in sync and ensures all bugs fixed in drupal 7 are fixed in drupal 8 as well.
Comment #7
Letharion CreditAttribution: Letharion commentedI came here because in apachesolr_entity_update() I got the same error message from the ->execute() line at the end of the function.
In my case it's not repeatable though. I'm creating a million nodes on a daily basis, and I've only seen this message a single time. (It could have happened more often and I haven't noticed though).
Comment #8
Gastonia CreditAttribution: Gastonia commentedTo answer @2, it seems that this is still an issue. I was asked to create a new thread instead of continuing the old one.
As of this writing, I get this error still quite often. Now running D7.16 with all modules up to date. Let me know if you would like me to provide any more details.
Comment #9
Letharion CreditAttribution: Letharion commentedI've hacked my core with the following patch to get some better debug data out. But after I applied it the error stopped reproducing >_<. Uploading in here so others with the issue can try applying it as well.
Comment #10
marcus_clements CreditAttribution: marcus_clements commentedWe are also seeing this error several times a day.
Comment #11
xjmComment #12
alanom CreditAttribution: alanom commentedSo, issue summary - this bug appears often, and 2 months in, no-one has any idea what is causing it. Correct me if wrong.
For what it's worth, I usually see this error when field-related actions (e.g. deleting nodes) happen concurrently.
Comment #13
catchIf you're getting this error, please post your MySQL version.
http://bugs.mysql.com/bug.php?id=38187 looks like a possible issue if you're running 5.0.*
Comment #14
alanom CreditAttribution: alanom commentedMySQL 5.0.95 for me, so one sample in, that's a possibility. Looks like it was 5.1.33 that the posted bug was fixed in.
Comment #15
Gastonia CreditAttribution: Gastonia commentedRunning mysql --version I get:
mysql Ver 14.14 Distrib 5.5.28, for debian-linux-gnu (x86_64) using readline 6.2
Comment #16
Gastonia CreditAttribution: Gastonia commented@alanomoly #12 - I agree that this is a concurrency issue. Our errors happen when people are trying to post (save) nodes concurrently instead of delete. still happening as of mysql 5.5.28 and drupal 7.17
Comment #17
neRok CreditAttribution: neRok commentedMarked #1792918: SAVEPOINT error in file_usage_add as duplicate of this issue.
Comment #18
carn1x CreditAttribution: carn1x commentedGetting a similar error:
MySQL is newer than #13 is hoping for:
Comment #19
braindrift CreditAttribution: braindrift commentedHave a similar error message:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT savepoint_1 does not exist: ROLLBACK TO SAVEPOINT savepoint_1; Array ( ) in node_save() (line 1198 of /var/www/htdocs/.../modules/node/node.module).
The error doesn't appear if I change the storage engine of the table file_usage from InnoDB to MyISAM
Comment #20
j0rd CreditAttribution: j0rd commentedSame problem. Happens for me during feeds import, with apachesolr running on Drush.
MySQL 5.1, PHP 5.3.
Comment #21
RunePhilosof CreditAttribution: RunePhilosof commented@dendie that would probably be because MyISAM doesn't support transactions.
Comment #22
Erik.Johansson CreditAttribution: Erik.Johansson commentedThis error occurs for me when a order is created.
The server is running mysql version mysql 14.14 Distrib 5.5.34.
Drupal 7.23
PHP 5.3.10
Comment #23
Anonymous (not verified) CreditAttribution: Anonymous commentedwe are also getting this sporadically when viewing or editting a node (we have tracker enabled).
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT savepoint_1 does not exist: ROLLBACK TO SAVEPOINT savepoint_1; Array
(
)
in _tracker_add() (line 264 of /home/km/modules/tracker/tracker.module).
as per comment #13.
Drupal 7.22
php 5,3,27
mysql 5.1.67
Comment #24
pounardI still experience this issue too. This indeed seems to happen during in concurrency scenarios.
Code like this:
Will sadly loose the current exception when another happens during rollback.
While a better algorithm such as:
Will catch the real business error and tell us what we need to know.
Which makes me think that the
SQLSTATE[42000] ... 1305 SAVEPOINT ...
error we all experience are actually hiding the real exception behing, and for some reason, probably a poorly coded algorithm somewhere or a MySQL bug, we cannot solve the real cause, which in concurrency scenarios could be a concurrent transaction deadlock timeout reached instead.Meanwhile, I did a very simple patch that should unhide the original exception that did trigger the rollback by using the attached patch.
The attached patch was made using SVN diff so please apply it manually and not with git. Please also note it has been made on a 7.15 core.
Comment #25
pounardOups wrong patch attached.
Comment #26
N1ghteyes CreditAttribution: N1ghteyes commentedim also getting the issue, currently its occuring when uploading files, and changing the state of checkboxes at the same time, while trying to update a node from a custom form.
Drupal 7.32-dev
Comment #27
jhedstrom#25 should be at needs review.
Comment #31
ufku CreditAttribution: ufku commentedCan anyone reproduce this in 8.x? "bugs should be fixed in HEAD first" but we don't have any evidence that it exists in 8.x
Comment #32
lhridley CreditAttribution: lhridley commentedRerolling patch from comment 25:
Comment #33
lhridley CreditAttribution: lhridley commentedComment #34
akolahi CreditAttribution: akolahi commentedI was receiving this error when using VBO on large numbers of items. The error would cause the batch process to stop. While I don't understand the root cause of the error, the above patch #32 does appear to allow my VBO batches to process without failing.
Thank you.
Comment #35
Andy_D CreditAttribution: Andy_D at Investis Digital commentedSeen in Drupal 7.44 & MySQL 5.5.52-0ubuntu0.14.04.1-log (Ubuntu)
followed by
I have applied patch #32 and will monitor for any re-occurrence - thanks pounard & lhridley!
Comment #36
tim.plunkettI am able to reproduce in D8 with patches from #933004: Test that all form elements have a title for accessibility, wherein I do a lot of entity creation and some exception catching.
Comment #37
dunx CreditAttribution: dunx commentedPDOException: SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT savepoint_1 does not exist: ROLLBACK TO SAVEPOINT savepoint_1; Array ( ) in EntityAPIController->save() (line 481 of [snip]/entity.controller.inc).
When trying to create a user account.
Comment #39
flocondetoileRecently had this issue too. On a commerce product (core 8.4.4, commerce 2.3). Seems this occurs simply by visiting the page.
AH01071: Got error 'PHP message: Uncaught PHP Exception Drupal\\Core\\Entity\\EntityStorageException: "SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT savepoint_1 does not exist: ROLLBACK TO SAVEPOINT savepoint_1; Array\n(\n)\n" at /mysite/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php line 805\n'
Comment #40
mr.baileysSame issue, Drupal 8.5.2, MySQL 5.7.17
Attempt to port the patch from #32 to D8
Comment #41
mahtab_alam CreditAttribution: mahtab_alam at Valuebound commentedComment #43
anbarasan.r CreditAttribution: anbarasan.r at NBCUniversal commentedThis should be
} catch (\PDOException $e) {
, missing\
beforePDOException
Comment #44
anbarasan.r CreditAttribution: anbarasan.r at NBCUniversal commentedMade that specific change and re rolling that patch against 8.6.x
Comment #45
anbarasan.r CreditAttribution: anbarasan.r at NBCUniversal commentedFixing CS issue and removing other line
Comment #46
aditya.ghan CreditAttribution: aditya.ghan as a volunteer commentedHi All,
I tried the patch #45, it seems to me that the issue still exists.
I'm facing this issue while saving content randomly on Drupal 8.5. Does anyone else still face the same issue?
Thanks for your help!
Adi
Comment #47
rajeevkNeed work as patch provided in #45 doesn't solve the issue. It's still occurring for content type with Paragraph fields. Thanks
Comment #48
Rhino-new CreditAttribution: Rhino-new commentedI've applied patch #32 but still get this error
PDOException: SQLSTATE[HY000]: General error: user-supplied statement does not accept constructor arguments: ROLLBACK TO SAVEPOINT savepoint_1; Array ( ) in EntityAPIController->save() (line 481 of /sites/all/modules/entity/includes/entity.controller.inc).
I have
Drupal 7.65
PHP 7.2.15
mysql 5.7.25
Specific modules used when this happens:
video
paragraphs
Comment #50
karthikeyan-manivasagam CreditAttribution: karthikeyan-manivasagam commentedthis happened for us while updating paragraph update version 8018, still facing the same.
Comment #52
parasolx CreditAttribution: parasolx as a volunteer and commentedPatch # 32 has fixed my Drupal 7 error. I'm testing a load test with 200 concurrent users to create a node programmatically through an API request. Almost 3 or 5 bugs occur before patching. Once patched, the entire request was successfully created in the database.
Comment #53
shubhangi1995when trying to save node in hook_comment_insert -> the issue is still there in core: 8.9
Comment #54
TrevorBradley CreditAttribution: TrevorBradley commentedTo anyone hitting this - we were doing some load testing on a server and hit the "savepoint_1" error hard. It wasn't consistent, but it was reproducible under load.
One of the problems diagnosing savepoint_1 appears to be that SqlContentEntityStorage::save() calls $transaction->rollBack(); as part of an Exception catch. $transaction->rollBack() runs a number of commands that come around and run SqlContentEntityStorage::save() AGAIN. This time around, the savepoint_1 error is hit and the system dies and logs savepoint_1.
savepoint_1 is likely a red herring - you need to figure out what the original exception was that triggers the rollback in the first place.
We fixed this by swapping the order of the rollback and watchdog_exception, changing this:
to this:
For us, this looks like it's a SQL Deadlock issue, as described in #2833539: SQLSTATE[40001]: Serialization failure: 1213 Deadlock
I'm not sure I'd advocate for a patch that swaps the order of watchdog_exception() and rollBack(), as watchdog_exception has to log to the database as well, but if you're trying to crack this problem, look here first.
TL;DR: If you see a savepoint_1 error, it's likely masking some other error that's getting lost in the catch block of SqlContentEntityStorage::save().
Comment #55
BenjaminLeibinger CreditAttribution: BenjaminLeibinger commentedWe also had this issue in combination with #2833539: SQLSTATE[40001]: Serialization failure: 1213 Deadlock
and created the 1803886-switch-rollback-and-exception-logging.patch.
Comment #56
ptmkenny CreditAttribution: ptmkenny commentedComment #58
skrugHi, I made a patch for Drupal 9.3.x based on the patch of comment #55 because the source code in Drupal 9.3.x is a little bit different.
Comment #59
Shashwat Purav CreditAttribution: Shashwat Purav at Portage CyberTech for Drupal Association commentedComment #64
ArtusamakRerolled patch for 9.4.x in MR !3105.
Comment #70
kerasai CreditAttribution: kerasai commentedRe-roll for 10.1.x.
https://git.drupalcode.org/project/drupal/-/merge_requests/5283/diffs
Comment #71
anrikun CreditAttribution: anrikun commentedAs pointed out at #54, this patch is absolutely not a viable solution. Logging exception before rolling back transaction basically means that the exception won't be logged.