Drupal 10.3.6
SQL Server Driver (not MySQL)
8.x-3.0-rc2
Preface
Please be aware we use SQL Server driver and a Microsoft stack. This is a non-negotiable item for this system.
Problem/Motivation
The problem is I can't get my Feeds import to work with cron. Supposedly when cron is configured, feeds import will run. I've tried several things with cron. I have a Task Scheduler which goes out every day to the browser URL and triggers cron. This works. Initially, I turned off Drupal cron because that was recommended when you use an outside method. Now I have it turned on because the Task Scheduler method was not working.
Here is the error I'm seeing.
Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Cannot update identity column 'lid'.: UPDATE [feeds_import_log_entry] SET [operation]=:db_update_placeholder_0, [message]=:db_update_placeholder_1, [timestamp]=:db_update_placeholder_2, [variables]=:db_update_placeholder_3, [entity_type_id]=:db_update_placeholder_4, [entity_id]=:db_update_placeholder_5, [entity_label]=:db_update_placeholder_6, [item_id]=:db_update_placeholder_7, [import_id]=:db_update_placeholder_8, [feed_id]=:db_update_placeholder_9, [lid]=:db_update_placeholder_10, [item]=:db_update_placeholder_11 WHERE [lid] = :db_condition_placeholder_0; Array ( [operation] => failed [message] => SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Cannot update identity column 'lid'.: UPDATE [feeds_import_log_entry] SET [operation]=:db_update_placeholder_0, [message]=:db_update_placeholder_1, [timestamp]=:db_update_placeholder_2, [variables]=:db_update_placeholder_3, [entity_type_id]=:db_update_placeholder_4, [entity_id]=:db_update_placeholder_5, [entity_label]=:db_update_placeholder_6, [item_id]=:db_update_placeholder_7, [import_id]=:db_update_placeholder_8, [feed_id]=:db_update_placeholder_9, [lid]=:db_update_placeholder_10, [item]=:db_update_placeholder_11 WHERE [lid] = :db_condition_placeholder_0; Array ( [operation] => updated [message] => [timestamp] => 1729497605 [variables] => a:0:@ [entity_type_id] => user [entity_id] => 8027 [entity_label] => label: 111804 [item_id] => value:111804 [import_id] => 620 [feed_id] => 1 [lid] => 4495 [item] => private://feeds/log/620/items/4495.json ) [timestamp] => 1729497605 [variables] => a:0:{} [entity_type_id] => user [entity_id] => 8027 [entity_label] => label: 111804 [item_id] => value:111804 [import_id] => 620 [feed_id] => 1 [lid] => 4496 [item] => private://feeds/log/620/items/4496.json ) in Drupal\sqlsrv\Driver\Database\sqlsrv\ExceptionHandler->handleExecutionException() (line 39 of E:\wwwroot\jurorportal\web\modules\contrib\sqlsrv\src\Driver\Database\sqlsrv\ExceptionHandler.php).
Drupal cron is set to run every day currently, but I don't get any indication that's happening. The only cron run that's working is the one I set up with Task Scheduler.
Steps to reproduce
Set up Drupal 10 using SQL Server driver. Set up Feeds module. Create a feed type and feed instance. Set up cron. See if it runs properly.
I don't know how to proceed. If you think this is actually a SQL Server module issue, please advise. Thanks in advance.
Issue fork feeds-3482189
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 #2
ronraney commentedComment #5
megachrizI do not have a MS SQL Server driver ready, but based on the error message, I made a change that perhaps works. The error says "Cannot update identity column 'lid'", and the code is passing a value for 'lid' when updating a log entry. So maybe the issue gets fixed when the code no longer passes a value for 'lid'.
Can you try the code from 3482189-cron-sql-server-driver to see if that helps?
Comment #6
ronraney commentedI will try, but honestly I'm not super familiar with the new way of doing things. I'm still in the "patch" world. I'll try to get it figured out on Google.
Comment #7
megachrizIf you click the "plain diff" link, then you get a text file that you could use as a patch.
Comment #8
ronraney commenteddeleted
Comment #9
ronraney commentedI found the link above
https://git.drupalcode.org/project/feeds/-/merge_requests/203.diff
I applied the patch and there was no error. I cleared cache. I ran cron manually.
The errors are gone in Recent Logs. That part is resolved.
If I filter logs by "Feeds" it doesn't show that the feed was imported just now. While the SQL error was resolved, it still apparently didn't import.
Comment #10
ronraney commentedLogs show that feeds_cron() and feeds_log_cron() ran, but no sign of any changes to the entity fields that are imported.
Comment #11
megachrizIs there something scheduled to be imported? If not, try to start an import using the “Import in background” link and then run cron. If the feed is currently locked, unlock it first and then try to import in background.
Note: A feed becomes locked when an import for it is started or planned, to prevent running two imports for the same feed at the same time. But if an import abruptly ended due to an error, the feed may remain in a locked state without the import getting continued. In this case, it is good to unlock it manually.
Comment #12
ronraney commentedIt was locked. I'm unlocking, then importing in background. After this, I'll try a cron run. Thanks for your help.
Comment #13
ronraney commentedCron updated the data. The feeds filter in Logs shows updates at the same time as cron. I think it's working :)
Comment #14
ronraney commentedI'm actually having a problem with the scheduled import and cron. When I schedule the feed then run cron, it is incomplete. When I run the feed manually, it takes a lot longer but it's complete.
Any idea why the cron import isn't doing a complete feed import?
Comment #15
megachrizBecause there is a time limit on cron runs, if your import is large, it can take multiple cron runs to complete an import. Feeds is given about a minute per cron run to do its thing.
Comment #16
ronraney commentedOK thanks. I guess I need to look into running it more often.
Comment #18
megachrizI merged the code for the issue you had with feeds_log and since it looks like your other issues with the module are now also solved, I'm marking this issue as "fixed".
Feel free to reopen or open a new issue if you experience more issues related to the MS SQL Server Driver. 🙂