After saving a model from inside a command I am given the beautiful Segmentation Fault error.
I am not sure what is causing this so any help would be greatly appreciated. According to php -i Zend OPCache is turned Off and I do not have XCache. I have provided a stack trace from gdb below.
I have the following in my command:-
print_r("Updating active state on contract... \n");
$this->contract->active = $this->status;
print_r("Saving contract state... \n");
$this->contract->save();
print_r("Saved contract state... \n");
And the following is output to the console:-
Updating active state on contract...
Saving contract state...
Segmentation fault
#0 0x00007feca2520ae0 in bf_zend_execute () from /usr/lib/php/20151012/blackfire.so
#1 0x000055a03022e88d in ?? ()
#2 0x000055a0301e9d9b in execute_ex ()
#3 0x000055a030199861 in dtrace_execute_ex ()
#4 0x00007feca2520ae6 in bf_zend_execute () from /usr/lib/php/20151012/blackfire.so
#5 0x000055a03019b4c9 in zend_call_function ()
#6 0x000055a0301c7702 in zend_call_method ()
#7 0x000055a0301e1a23 in zend_std_read_dimension ()
#8 0x000055a0301eae66 in ?? ()
#9 0x000055a0301eb887 in ?? ()
#10 0x000055a0301e9d9b in execute_ex ()
#11 0x000055a030199861 in dtrace_execute_ex ()
#12 0x00007feca2520ae6 in bf_zend_execute () from /usr/lib/php/20151012/blackfire.so
#13 0x000055a03022e88d in ?? ()
#14 0x000055a0301e9d9b in execute_ex ()
#15 0x000055a030199861 in dtrace_execute_ex ()
#16 0x00007feca2520ae6 in bf_zend_execute () from /usr/lib/php/20151012/blackfire.so
#17 0x000055a03022e88d in ?? ()
#18 0x000055a0301e9d9b in execute_ex ()
#19 0x000055a030199861 in dtrace_execute_ex ()
#20 0x00007feca2520ae6 in bf_zend_execute () from /usr/lib/php/20151012/blackfire.so
#21 0x000055a03022e88d in ?? ()
#22 0x000055a0301e9d9b in execute_ex ()
#23 0x000055a030199861 in dtrace_execute_ex ()
#24 0x00007feca2520ae6 in bf_zend_execute () from /usr/lib/php/20151012/blackfire.so
#25 0x000055a03022e88d in ?? ()
#26 0x000055a0301e9d9b in execute_ex ()
#27 0x000055a030199861 in dtrace_execute_ex ()
#28 0x00007feca2520ae6 in bf_zend_execute () from /usr/lib/php/20151012/blackfire.so
#29 0x000055a03022e88d in ?? ()
#30 0x000055a0301e9d9b in execute_ex ()
#31 0x000055a030199861 in dtrace_execute_ex ()
#32 0x00007feca2520ae6 in bf_zend_execute () from /usr/lib/php/20151012/blackfire.so
#33 0x000055a03022e88d in ?? ()
#34 0x000055a0301e9d9b in execute_ex ()
#35 0x000055a030199861 in dtrace_execute_ex ()
#36 0x00007feca2520ae6 in bf_zend_execute () from /usr/lib/php/20151012/blackfire.so
#37 0x000055a03022e88d in ?? ()
#38 0x000055a0301e9d9b in execute_ex ()
#39 0x000055a030199861 in dtrace_execute_ex ()
#40 0x00007feca2520ae6 in bf_zend_execute () from /usr/lib/php/20151012/blackfire.so
#41 0x000055a03022e88d in ?? ()
#42 0x000055a0301e9d9b in execute_ex ()
#43 0x000055a030199861 in dtrace_execute_ex ()
#44 0x00007feca2520ae6 in bf_zend_execute () from /usr/lib/php/20151012/blackfire.so
I'm not sure what's causing this--all I'm trying to do is save a model from inside a command.
I'm not sure about what the actual issue is here but i seems related to some backfire extension for PHP try to disable that and try again.
Let me know if it fixes the issue, and if it does you report this to the maintainers of backfire.
Please ask on the forums, we try to keep this repo for bug reporting only.
Any segfaults are not bugs in Laravel anyway. They are bugs in PHP.
Changed my implementation to use DB:: instead to update the table directly. Looks like the actual issue was in the assignment of $this->contract->active = $this->status; because $this->contract->save() on it's own worked fine.
I know its been more of a year, but this is #1 in search results, so I'll explain what it was for me:
I had a model-method that would use $this->save() under certain conditions. But I also had a model-observer that would use that same method. This caused a recursion which triggered the segfault.
So if you have this issue check your observers!
Same here,
I've had model, that was creating another model from Queue process and switch from $model->save() to DB::table()->insert() helped.
Most helpful comment
I know its been more of a year, but this is #1 in search results, so I'll explain what it was for me:
I had a model-method that would use
$this->save()under certain conditions. But I also had a model-observer that would use that same method. This caused a recursion which triggered the segfault.So if you have this issue check your observers!