Problem/Motivation

Receiving a segmentation fault in PHP7 when trying to access the migrations listing page @ /admin/structure/migrate/manage/wine/migrations .

Simply ran the following:

drush --uri=domain en migrate_example_advanced migrate_tools -y

Proposed resolution

This problem was also reported over at drupal.org/project/migrate_source_json with a solution:

#2660670: PHP 7 Seg Fault

In-depth response @ https://www.drupal.org/node/2660670#comment-11154531

CommentFileSizeAuthor
#2 php_7_seg_fault-2731697-2.patch759 bytessylus

Comments

sylus created an issue. See original summary.

sylus’s picture

Status: Active » Needs review
StatusFileSize
new759 bytes
sylus’s picture

Related issues: +#2660670: PHP 7 Seg Fault
sylus’s picture

Title: PHP 7 Seg Fault » PHP 7 Seg Fault in migrate_example_advanced
pguillard’s picture

Issue summary: View changes

I don't have that errorwith PPH7, last Drupal code on branch 8.2.x, last migrate_plus code on branch 8.x-2.x.

$ drush --uri=d8 en migrate_example_advanced migrate_tools -y
The following extensions will be enabled: migrate_example_advanced, migrate_tools, serialization, rest, migrate_example_advanced_setup
Do you really want to continue? (y/n): y
migrate_example_advanced was enabled successfully.                                                            [ok]
migrate_example_advanced_setup was enabled successfully.                                                      [ok]
migrate_tools was enabled successfully.                                                                       [ok]
migrate_tools defines the following permissions: administer migrations
rest was enabled successfully.                                                                                [ok]
rest defines the following permissions: restful delete entity:node, restful get migrate_example_advanced_position, restful get migrate_example_advanced_variety_items, restful get migrate_example_advanced_variety_multiple, restful get migrate_example_advanced_variety_list, restful get entity:node, restful patch entity:node, restful post entity:node
serialization was enabled successfully.                                                                       [ok]

But I get this error when installing migrate_example !

$ drush --uri=d8 en migrate_example -y
The following extensions will be enabled: migrate_example, migrate_example_setup
Do you really want to continue? (y/n): y
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1171 All parts of a PRIMARY KEY must be NOT  [error]
NULL; if you need NULL in a key, use UNIQUE instead in
/var/www/drupal8/core/lib/Drupal/Core/Database/Statement.php:59
Stack trace:
#0 /var/www/drupal8/core/lib/Drupal/Core/Database/Statement.php(59): PDOStatement->execute(Array)
#1 /var/www/drupal8/core/lib/Drupal/Core/Database/Connection.php(610):
Drupal\Core\Database\Statement->execute(Array, Array)
#2 /var/www/drupal8/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php(81):
Drupal\Core\Database\Connection->query('CREATE TABLE {m...', Array, Array)
#3 /var/www/drupal8/core/lib/Drupal/Core/Database/Schema.php(596):
Drupal\Core\Database\Driver\mysql\Connection->query('CREATE TABLE {m...')
#4 /var/www/drupal8/core/includes/database.inc(582):
Drupal\Core\Database\Schema->createTable('migrate_example...', Array)
#5 /var/www/drupal8/core/includes/schema.inc(122): db_create_table('migrate_example...', Array)
#6 /var/www/drupal8/core/lib/Drupal/Core/Extension/ModuleInstaller.php(197):
drupal_install_schema('migrate_example...')
#7 /var/www/drupal8/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83):
Drupal\Core\Extension\ModuleInstaller->install(Array, true)
#8 phar:///usr/local/bin/drush/commands/core/drupal/environment.inc(131):
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, true)
#9 phar:///usr/local/bin/drush/commands/core/drupal/environment.inc(198): drush_module_install(Array)
#10 phar:///usr/local/bin/drush/commands/pm/pm.drush.inc(1167): drush_module_enable(Array)
#11 phar:///usr/local/bin/drush/includes/command.inc(366): drush_pm_enable('migrate_example')
#12 phar:///usr/local/bin/drush/includes/command.inc(217): _drush_invoke_hooks(Array, Array)
#13 phar:///usr/local/bin/drush/includes/command.inc(185): drush_command('migrate_example')
#14 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#15 phar:///usr/local/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#16 phar:///usr/local/bin/drush/includes/startup.inc(325): drush_main()
#17 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
#18 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#19 {main}

Next Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42000]: Syntax error or access violation: 1171
All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead: CREATE TABLE
{migrate_example_beer_account} (
`aid` INT auto_increment DEFAULT NULL COMMENT 'Account ID', 
`status` INT NOT NULL COMMENT 'Blocked_Allowed', 
`registered` VARCHAR(255) NOT NULL COMMENT 'Registration date', 
`username` VARCHAR(255) NULL DEFAULT NULL COMMENT 'Account name (for login)', 
`nickname` VARCHAR(255) NULL DEFAULT NULL COMMENT 'Account name (for display)', 
`password` VARCHAR(255) NULL DEFAULT NULL COMMENT 'Account password (raw)', 
`email` VARCHAR(255) NULL DEFAULT NULL COMMENT 'Account email', 
`sex` INT NULL DEFAULT NULL COMMENT 'Gender (0 for male, 1 for female)', 
`beers` VARCHAR(255) NULL DEFAULT NULL COMMENT 'Favorite Beers', 
PRIMARY KEY (`aid`)
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT 'Beers accounts.'; Array
(
)
 in /var/www/drupal8/core/lib/Drupal/Core/Database/Connection.php:671
Stack trace:
#0 /var/www/drupal8/core/lib/Drupal/Core/Database/Connection.php(635):
Drupal\Core\Database\Connection->handleQueryException(Object(PDOException), 'CREATE TABLE {m...', Array,
Array)
#1 /var/www/drupal8/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php(81):
Drupal\Core\Database\Connection->query('CREATE TABLE {m...', Array, Array)
#2 /var/www/drupal8/core/lib/Drupal/Core/Database/Schema.php(596):
Drupal\Core\Database\Driver\mysql\Connection->query('CREATE TABLE {m...')
#3 /var/www/drupal8/core/includes/database.inc(582):
Drupal\Core\Database\Schema->createTable('migrate_example...', Array)
#4 /var/www/drupal8/core/includes/schema.inc(122): db_create_table('migrate_example...', Array)
#5 /var/www/drupal8/core/lib/Drupal/Core/Extension/ModuleInstaller.php(197):
drupal_install_schema('migrate_example...')
#6 /var/www/drupal8/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83):
Drupal\Core\Extension\ModuleInstaller->install(Array, true)
#7 phar:///usr/local/bin/drush/commands/core/drupal/environment.inc(131):
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, true)
#8 phar:///usr/local/bin/drush/commands/core/drupal/environment.inc(198): drush_module_install(Array)
#9 phar:///usr/local/bin/drush/commands/pm/pm.drush.inc(1167): drush_module_enable(Array)
#10 phar:///usr/local/bin/drush/includes/command.inc(366): drush_pm_enable('migrate_example')
#11 phar:///usr/local/bin/drush/includes/command.inc(217): _drush_invoke_hooks(Array, Array)
#12 phar:///usr/local/bin/drush/includes/command.inc(185): drush_command('migrate_example')
#13 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#14 phar:///usr/local/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#15 phar:///usr/local/bin/drush/includes/startup.inc(325): drush_main()
#16 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
#17 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#18 {main}
pguillard’s picture

Issue summary: View changes
nlisgo’s picture

I have been experiencing this issue. I applied the patch in #2 and #2660670-10: PHP 7 Seg Fault and I am now able to perform 'drush ms' without experiencing a 'Segmentation Fault'.

I am now going to see if both patches are necessary to clear the issue for me. And report back.

nlisgo’s picture

The patch #2660670-10: PHP 7 Seg Fault is redundant as migrate_source_json is no longer a dependency of this project and that module may be deprecated in the near future if not already.

See: http://virtuoso-performance.com/blog/mikeryan/drupal-8-plugins-for-xml-a...

nlisgo’s picture

I have queued this patch for testing with a PHP 7 environment as this issue seems to only be affecting those with PHP 7.

nlisgo’s picture

The fix is working for me and the PHP 7 test run is green - although that may not be as valuable as it appears if there is no breaking test without this fix.

mikeryan’s picture

Title: PHP 7 Seg Fault in migrate_example_advanced » JSON parser triggers segfault with PHP7
Status: Needs review » Fixed

Reproduced the problem, and the patch fixes it - thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.