Skip to content
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

[BUG] Phalcon\Config->get() is crashing Phalcon: "invalid opcode in phalcon.so". #1739

Closed
temuri416 opened this issue Dec 24, 2013 · 8 comments

Comments

@temuri416
Copy link
Contributor

temuri416 commented Dec 24, 2013

The set-up:

  1. latest phalcon 1.3.0
  2. phpinfo.htm <--- phpinfo

Very early in the exec cycle of my app there's this code:

/** @var Phalcon\Config */
$config = require($configFilename);

if ($config->get('params')['static_assets_dir'] === FALSE) {
    // Fatal error. Execution will not continue.
    die('Static assets directory does not exist or is not writable.');
}

Executing $config->get() crashes php-fpm with the following message in kern.log:

krfsphalcon kernel: [ 4503.498064] traps: php-fpm[30105] trap invalid opcode ip:7f92feec54c7 sp:7fff90872800 error:0 in phalcon.so[7f92fee68000+262000]

Please help :-)

Thanks!

@temuri416
Copy link
Contributor Author

Hm. Compiling it from ext/ fixed the crash.

I may have used a wrong php-config when I compiled it the first time.

Actually, how can I compile Phalcon and indicate which of the two available php-config utils to use?

@ghost
Copy link

ghost commented Dec 24, 2013

./configure --with-php-config=/path/to/php-config

invalid opcode

This means that gcc generated something very wrong that is not supported by your processor (I noticed several times that -march=native may generate the code not supported by the CPU the code is compiled on). If you want to debug this, let me know :-)

@temuri416
Copy link
Contributor Author

:-) no, thank you. doesn't look it needs debugging. I just think that the wrong php-config got in the way.

My question was - how do I use automatic build/install and still be able to point to the right php-config?

@ghost
Copy link

ghost commented Dec 24, 2013

I think you will have to edit ./build/install script:

#Perform the compilation
phpize && ./configure --enable-phalcon && make && make install && echo -e "\nThanks for compiling Phalcon!\nBuild succeed: Please restart your web server to complete the installation"

Replace with

#Perform the compilation
/path/to/proper/phpize && ./configure --with-php-config=/path/to/php-config --enable-phalcon && make && make install && echo -e "\nThanks for compiling Phalcon!\nBuild succeed: Please restart your web server to complete the installation"

@temuri416
Copy link
Contributor Author

ok, something is definitely wrong.

I did fix ./build/install script according to your instructions, but phalcon.so is crashing again on the same line.

Compiling it from ext/ results in:

Fatal error: Call to undefined method Phalcon\Mvc\View::isDisabled()

Can we investigate it?

Thanks!

@temuri416
Copy link
Contributor Author

let me do a bit of investigation before we return to this.

@temuri416
Copy link
Contributor Author

Here's the situation with latest 1.3.0.

  1. If I edit install script as it is described above and provide correct phpize and php-config, Phalcon explodes as I described it originally. This means, my original suggestion that I may have used the wrong php-config is irrelevant. It crashes no matter which php-config was used.
  2. If I build it from ext/ folder with:
/var/web/php/bin/phpize
./configure CFLAGS="-O0 -g3" --with-php-config=/var/web/php/bin/php-config
make -j4
sudo make install

then #1714 is back.

Editing ext/di.c and commenting out:

if (!nusphere_dbg_present) {
    /*phalcon_di_object_handlers.get_properties = phalcon_di_get_properties;*/
}

and recompiling fixes everything.

So, two questions:

  1. Why does the result default install script crash as I described
  2. Why is [BUG] Latest build of Phalcon 1.3.0 is crashing PHPEd #1714 back?

Thanks!

@ghost
Copy link

ghost commented Dec 30, 2013

As for 1 — this is probably a bug ig gcc — I suspect it uses AVX instructions though they are not supported by your CPU.

Could you please:

  1. Post the output of cat /proc/cpuinfo | grep flags
  2. Post the output of gcc -march=native -mtune=native -Q -O2 --help=target
  3. Analyze the core dump with gdb: gdb /var/web/php/sbin/php-fpm unpacked/CoreDump and post the output of x/16i $pc (this command should be run at (gdb) prompt)

@temuri416
Copy link
Contributor Author

I'm gonna get to this issue a bit later. It's still on my radar.

@temuri416
Copy link
Contributor Author

Not sure what was going on earlier. I've just compiled latest 1.3.0 and all is well. I still suspect that something is not right on systems where there are two php-config files and the one that's picked up by the script isn't the one that belongs to currently used PHP instance.

@digitronac
Copy link
Contributor

thanks @temuri416 ! compiling from ext/ fixed same problem for me on php 5.5.10 and phalcon 1.3.1.
just to add for someone with same problem that when running from CLI error that i got was "illegal instruction" and from nginx was opcode error like yours

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants