-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP FPM exit with signal 8 (SIGFPE - core dumped) #141
Comments
Similar issue with Apache2 on Ubuntu 16.04 using the 4.0.3 drivers. Definitely broken with parameterized update queries. [Fri Aug 26 11:10:27.531094 2016] [core:notice] [pid 21449] AH00051: child pid 23078 exit signal Floating point exception (8), possible coredump in /etc/apache2 |
I just start wrote a small script to reproduce this problem on my vmware, I realize that I have a mistake on my code (As driver 4.0.2 and before, the code still work) <?php
$user = 'sa';
$pass = '123';
$out1 = '';
$out2 = '';
try {
$db = new PDO("sqlsrv:Server=10.0.1.50,1433;Database=TestDB", $user, $pass);
$sth = $db->prepare("EXEC [dbo].Create_Account ?, ?, ?");
$sth->bindValue(1, 'tester00001');
$sth->bindValue(2, '123456');
$sth->bindValue(3, '[email protected]');
$sth->bindValue(4, $out1);
$sth->bindValue(5, $out2);
$sth->execute();
echo $out1 . '\n';
echo $out2 . '\n';
} catch(Exception $e) {
var_dump($e);
}
?> ALTER PROC [dbo].[Create_Account]
@username nvarchar(50),
@password nvarchar(50),
@email nvarchar(255),
@order_idx int OUTPUT,
@v_error tinyint OUTPUT
AS
SET NOCOUNT ON
BEGIN TRAN
INSERT users (username, password, email) VALUES (@username, @password, @email)
SET @order_idx = 1
SET @v_error = 1
COMMIT TRAN From the stored procedure above, the output return has type int, but in my php code, I define it as ''. $out1 = 0;
$out2 = 0; |
Another problem about empty string can make php-fpm process crash too, the log from system also about "trap divide error" ALTER PROC [dbo].[Update_Account]
@username nvarchar(50),
@password nvarchar(50),
@email nvarchar(255),
@last_login datetime,
@order_idx int output,
@v_error tinyint OUTPUT
AS
SET NOCOUNT ON
BEGIN TRAN
UPDATE users SET password = @password, email = @email, last_login = @last_login WHERE username = @username
SET @order_idx = 1
SET @v_error = 1
COMMIT TRAN PHP code <?php
$user = 'sa';
$pass = '123';
$out1 = 0;
$out2 = 0;
try {
$db = new PDO("sqlsrv:Server=10.0.1.50,1433;Database=TestDB", $user, $pass);
$sth = $db->prepare("EXEC [dbo].Update_Account ?, ?, ?, ?");
$sth->bindValue(1, 'tester00001');
$sth->bindValue(2, ''); // PHP-FPM crash
$sth->bindValue(3, '[email protected]');
$sth->bindValue(4, '2022-01-01 00:00:00.000');
$sth->bindValue(5, $out1);
$sth->bindValue(6, $out2);
$sth->execute();
echo $out1 . '\n';
echo $out2 . '\n';
} catch(Exception $e) {
var_dump($e);
}
?> Workaround this problem: $sth->bindValue(2, "''"); // wrap single quote with double quote |
@oxycoder both the issues referenced above are fixed by our latest release: https://github.com/Microsoft/msphpsql/releases/tag/4.0.4-Linux. Can you help us verify? |
OS: Ubuntu 16.04 with Nginx
Driver: 4.0.3
Tested on PHP-FPM 7.0.8 and 7.0.10 give same result
/var/log/php7.0-fpm.log
/var/log/syslog
Aug 26 00:55:13 api kernel: [ 5691.115511] traps: php-fpm7.0[72407] trap divide error ip:7f2fb56b6cec sp:7ffeaa469b10 error:0 in php_pdo_sqlsrv_7_nts.so[7f2fb565a000+8d000]
This error will return 502 Bad Gateway on nginx because PHP process crash. It happen with Update query.
The text was updated successfully, but these errors were encountered: