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

Problems with Controllers #5

Closed
sraka1 opened this issue Apr 16, 2012 · 12 comments
Closed

Problems with Controllers #5

sraka1 opened this issue Apr 16, 2012 · 12 comments

Comments

@sraka1
Copy link

sraka1 commented Apr 16, 2012

Another bug.

Here's another bug. When requesting something with an existing controller, but a non-existent action, phalcon (I presume, /tmp/phalcon-debug.a is empty, not sure why, is it a different file on the dev branch?) crashes. Browsers get either content decoding failed or just no response from the server. _I believe this started to happen when I switched from the release to the dev branch._ <-- SEE EDIT Haven't located the problem yet, have to check.

sraka1

EDIT:
It's the same on release branch. Check out for example http://invo.phalconphp.com/about/nonexistent

Proposed fix. A 404 header and a page does not exist page :). This, however should be possibly to customize by the user :) Maybe will do myself, but I'm a bit lazy...

@sraka1
Copy link
Author

sraka1 commented Apr 16, 2012

Here seems to be the issue somewhere... in dispatcher.c
What obviously happens is that r8 is always true.

        PHALCON_INIT_VAR(r8);
        Z_ADDREF_P(v10);
        PHALCON_INIT_VAR(c1);
        ZVAL_BOOL(c1, 0);
        PHALCON_CALL_FUNC_PARAMS_2(r8, "class_exists", v10, c1, 0x000);
        Z_DELREF_P(v10);
        if (!zend_is_true(r8)) {
            PHALCON_INIT_VAR(i1);
            object_init_ex(i1, phalcon_exception_class_entry);
            PHALCON_INIT_VAR(r9);
            PHALCON_CONCAT_BOTH(r9,  "Class ", v10, " was not found on controller file");
            Z_ADDREF_P(r9);
            p4[0] = r9;
            PHALCON_CALL_METHOD_PARAMS_NORETURN(i1, "__construct", 1, p4, PHALCON_CALL_CHECK);
            Z_DELREF_P(p4[0]);
            zend_throw_exception_object(i1 TSRMLS_CC);
            Z_ADDREF_P(i1);
            PHALCON_MM_RESTORE();
            return;
        }

@ghost ghost assigned phalcon Apr 17, 2012
@phalcon
Copy link
Collaborator

phalcon commented Apr 17, 2012

hi sraka1, I can't reproduce this crash on my machine, although, actually, it's possible to implement a notFoundAction to control those situations. It has not been implemented in the INVO application right now.

Here's an example: http://phalconphp.com/documentation/controllers (Request and Response section)

Are you working on linux?

@phalcon
Copy link
Collaborator

phalcon commented Apr 17, 2012

Also, It actually produces a 404 header, look:

not

@sraka1
Copy link
Author

sraka1 commented Apr 17, 2012

Nope. Still experiencing this. A look at Wireshark however, gives this:

Wireshark Dump

Okay, it's failing at gzip compression, HOWEVER, what seems to be decoded has some redirect script to linksys.com. My router comes to mind. Okay, I guess it has a bug or something. BUT, why does this only appear when there is a non-existant view on an existing controller on a PhalconPHP site. There must be something out of the ordinary sent there for my router to go "loco" :)

EDIT:
http://redwolfinternet.com/?p=79

Conclusion: I have a very rare firmware version and router model. This router is very buggy.

EDIT2: Hacked firmware installed, everything works great! Fixed! Sorry for the trouble!

@sraka1 sraka1 closed this as completed Apr 17, 2012
@sraka1 sraka1 reopened this Apr 17, 2012
@sraka1 sraka1 closed this as completed Apr 17, 2012
@sraka1
Copy link
Author

sraka1 commented Apr 17, 2012

I might as well make a comment here.

root@ip-10-224-53-85:~# wget http://phalcon.qy.si/web/rolex >> rolex
--2012-04-17 17:06:12--  http://phalcon.qy.si/web/rolex
Resolving phalcon.qy.si... 46.137.155.228
Connecting to phalcon.qy.si|46.137.155.228|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2012-04-17 17:06:13--  (try: 2)  http://phalcon.qy.si/web/rolex
Connecting to phalcon.qy.si|46.137.155.228|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2012-04-17 17:06:15--  (try: 3)  http://phalcon.qy.si/web/rolex
Connecting to phalcon.qy.si|46.137.155.228|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2012-04-17 17:06:15 ERROR 404: Not Found.

I have also experienced the same on INVO, however in this example it's for my example. Now, what could be producing these empty responses (and I'm now 99% sure it's not my router) :D. Also this is also on pages with 200 OK. 1-2 times no response, 2nd or 3rd time always works. This is weird... And I have this on several computers!

EDIT:
Not sure if I experienced this on release branch (0.3.3), I forgot.

@phalcon
Copy link
Collaborator

phalcon commented Apr 17, 2012

Is it possible to generate a gdb backtrace when there is a empty response?

Here's a guide:

https://bugs.php.net/bugs-generating-backtrace.php

@sraka1
Copy link
Author

sraka1 commented Apr 17, 2012

It's definitely crashing. This is the apache2 log. Will update this comment with a gdb backtrace. IRC?

[Tue Apr 17 17:05:48 2012] [notice] child pid 8943 exit signal Segmentation fault (11)
[Tue Apr 17 17:06:12 2012] [notice] child pid 8946 exit signal Segmentation fault (11)
[Tue Apr 17 17:06:13 2012] [notice] child pid 8893 exit signal Segmentation fault (11)
[Tue Apr 17 17:44:19 2012] [notice] child pid 8961 exit signal Segmentation fault (11)

@phalcon phalcon reopened this Apr 18, 2012
@phalcon
Copy link
Collaborator

phalcon commented Apr 18, 2012

I think I found the problem, the phalcon memory manager doesn't support single-process multithreaded web servers, then, some memory related stuff was not thread safe producing segmentation faults cause double-freeing memory.

Just recoded it to add ZTS support, hope this time it works correctly.

@sraka1
Copy link
Author

sraka1 commented Apr 18, 2012

Nope. Still:

[Wed Apr 18 10:42:41 2012] [notice] child pid 32394 exit signal Segmentation fault (11)

EDIT:
This might not be the same problem. Perhaps. It only occurs under extreme-traffic (on localhost) (apachebench). I think at least.

@phalcon
Copy link
Collaborator

phalcon commented May 20, 2012

Hi, Just found a possible reason of the problem. I think gcc could be doing extra optimizations over null pointers. Please compile the extension again by setting first CFLAGS:

export CFLAGS="-O2 -fno-delete-null-pointer-checks"
phpize
./configure --enable-phalcon
make && make install

@phalcon
Copy link
Collaborator

phalcon commented Jun 5, 2012

Fixed updating PHP to PHP > 5.3.6

@lantian
Copy link
Contributor

lantian commented May 15, 2013

Got it again...
child pid NNN exit signal Segmentation fault (11)...

And response is 'No data received'...
And this happens with not default module (for example in blog https://github.com/lantian/PhalconEye/blob/master/app/modules/Blog/Controller/IndexController.php) when i want to visit '/blogs' link. With '/' link (core module) all is ok.
I found out that this depends on view engine... when I changing 'compileAlways' option to false - it goes fine ... and if i remove *.compiled view file - i will got 'No data received' on first request and on the following requests all fine...

While there is no response, this code returns normal rendered html:

$content = $application->handle()->getContent()

...with Phalcon 1.1.0 and PHP 5.4.6

@phalcon phalcon removed their assignment Mar 14, 2017
niden pushed a commit that referenced this issue May 11, 2019
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