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

debug panel not shown after upgrade to 2.0.10 #156

Closed
agungsijawir opened this issue Oct 22, 2016 · 17 comments
Closed

debug panel not shown after upgrade to 2.0.10 #156

agungsijawir opened this issue Oct 22, 2016 · 17 comments

Comments

@agungsijawir
Copy link

agungsijawir commented Oct 22, 2016

What steps will reproduce the problem?

On 2.0.9, debug panel shown properly.

My config (config/config.php) are

   'modules' => [
        'gii' => [
            'class' => '\yii\gii\Module',
            'allowedIPs' => ['127.0.0.1', '::1', '192.168.56.*'],
        ],
        'debug' => [
            'class' => '\yii\debug\Module',
            'allowedIPs' => ['127.0.0.1', '::1', '192.168.56.*'],
        ],
    ],

Did double check my remote IP (on vagrant) with following code:

var_dump($_SERVER['REMOTE_ADDR']);

the result are:

'192.168.56.1' (length=12)

Notice that 192.168.56.1 are on same class on allowedIPs.

What's expected?

Debug panel should be shown.

What do you get instead?

Debug panel shows only when hit error something like 404, 500.
Any request except error exception didn't captured.

Additional info

Q A
Yii version 2.0.10
PHP version 5.6.26
Operating system Ubuntu 16.04 x64
yii2-debug version 2.0.6
@agungsijawir
Copy link
Author

agungsijawir commented Oct 22, 2016

Update:

After few research and help from rawtaz on IRC, found out that debug not displayed because:

<div id="yii-debug-toolbar" data-url="/debug/default/toolbar?tag=580b70648631c" style="display:none" class="yii-debug-toolbar-bottom"></div>

yeah, there is "display: none" on style. using web browser dev-tools to remove that style found out this error:

Not Found (#404): Unable to find debug data tagged with '580b6f73d4c3b'.

From that error, seems that this update can not write debug data to "@app/runtime/debug" directory.
Double checking my runtime/debug permission it has 775, both on runtime & debug directory.

@dynasource
Copy link
Member

Have you checked if your debug folder has files?

@agungsijawir
Copy link
Author

agungsijawir commented Oct 23, 2016

@dynasource

yes, it has debug files produced by 2.0.9, but for 2.0.10, only exception files.

@dynasource
Copy link
Member

Is it actually logged?:

  • is your debug displayed with an empty $allowedIPs config?
  • do you have specific errors in your site prohibiting debug to log?

Is it actually saved?:

  • are you chowns and chmods correct? Perhabs 777
  • have you tried removing both "/runtime" & "/runtime/debug"?

@agungsijawir
Copy link
Author

Is it actually logged?:

like I said, only exception by triggering (throw new Exception).

is your debug displayed with an empty $allowedIPs config?

by using this config:

'modules' => [
        'debug' => [
            'class' => '\yii\debug\Module',
            'allowedIPs' => [],
        ],
    ],

no

Is it actually saved?:

no, there is no new files on runtime/debug.

are you chowns and chmods correct? Perhabs 777

currently on 775

[04:39 PM]-[vagrant@development]-[~/simhp/simona/runtime]-[git develop] 
$ stat -c "%a %n" *
775 cache
775 debug
775 HTML
775 logs
775 session
775 URI

[04:40 PM]-[root@development]-[/var/www/simhp/simona/runtime]-[git develop] 
# ls -l
total 24
drwxrwxr-x 1 www-data www-data 4096 Oct 22 19:57 HTML/
drwxrwxr-x 1 www-data www-data 4096 Oct 22 19:57 URI/
drwxrwxr-x 1 www-data www-data 4096 Oct 22 20:00 cache/
drwxrwxr-x 1 www-data www-data 4096 Oct 24 16:37 debug/
drwxrwxr-x 1 www-data www-data 4096 Oct  8 21:52 logs/
drwxrwxr-x 1 www-data www-data 4096 Oct 23 22:43 session/

[04:41 PM]-[root@development]-[/var/www/simhp/simona/runtime]-[git develop] 
# ls -l debug/
total 0
-rwxrwxr-- 1 www-data www-data 0 Oct 24 16:37 index.data*

no.

have you tried removing both "/runtime" & "/runtime/debug"?

[04:43 PM]-[root@development]-[/var/www/simhp/simona]-[git develop] 
# mv runtime runtime2
'runtime' -> 'runtime2'

[04:43 PM]-[root@development]-[/var/www/simhp/simona]-[git develop] 
# ls -l
total 52
drwxrwxr-x 1 www-data www-data 4096 Oct 22 16:48 assets/
-rwxrwxr-- 1 www-data www-data  299 Oct 23 18:20 codeception.yml*
drwxrwxr-x 1 www-data www-data 4096 Oct 24 16:35 config/
drwxrwxr-x 1 www-data www-data 4096 Oct 24 00:09 controllers/
drwxrwxr-x 1 www-data www-data 4096 Oct  8 21:22 models/
drwxrwxr-x 1 www-data www-data 4096 Oct 23 11:16 modules/
drwxrwxr-x 1 www-data www-data 4096 Oct 24 16:42 runtime/
drwxrwxr-x 1 www-data www-data 4096 Oct 22 19:57 runtime2/
drwxrwxr-x 1 www-data www-data 4096 Oct  8 21:22 templates/
drwxrwxr-x 1 www-data www-data 4096 Oct 23 19:34 tests/
drwxrwxr-x 1 www-data www-data 4096 Oct  8 21:22 uploads/
drwxrwxr-x 1 www-data www-data 4096 Oct 23 22:46 views/
drwxrwxr-x 1 www-data www-data 4096 Oct 23 20:31 web/

[04:43 PM]-[root@development]-[/var/www/simhp/simona]-[git develop] 
# cd runtime

[04:43 PM]-[root@development]-[/var/www/simhp/simona/runtime]-[git develop] 
# ls -l
total 8
drwxrwxr-x 1 www-data www-data 4096 Oct 24 16:42 cache/
drwxrwxr-x 1 www-data www-data 4096 Oct 24 16:42 logs/

yes, still no different.

@agungsijawir
Copy link
Author

agungsijawir commented Oct 24, 2016

running this function on vagrant:

<?php
var_dump('User: ' .get_current_user());

returns:

string(14) "User: www-data"

@agungsijawir
Copy link
Author

I am trying to trigger Not Found Exception, simply by open route that doesn't exists.

here's what I got:

[05:01 PM]-[root@development]-[/var/www/simhp/simona/runtime/debug]-[git develop] 
# ls -l
total 76
-rwxrwxr-- 1 www-data www-data 35783 Oct 24 17:00 580ddbf597b5e.data*
-rwxrwxr-- 1 www-data www-data 35092 Oct 24 17:01 580ddc65b0198.data*
-rwxrwxr-- 1 www-data www-data   556 Oct 24 17:01 index.data*

see, there is debug data file named 580ddbf597b5e.data and 580ddc65b0198.data*.

And this is screenshot from web view:

screenshot_2016-10-24_17-02-29

Only exception that recorded. The rest are not.

@dynasource
Copy link
Member

do you have YII_DEBUG = true

@agungsijawir
Copy link
Author

do you have YII_DEBUG = true

Name Value
Environment dev
Debug Mode Yes

yes, YII_DEBUG = true.

@dynasource
Copy link
Member

whats happens if you downgrade debug panel from 2.0.6 to 2.0.5?

@agungsijawir
Copy link
Author

agungsijawir commented Oct 24, 2016

whats happens if you downgrade debug panel from 2.0.6 to 2.0.5?

with yii2 v2.0.10 and downgrade yii2-debug to 2.0.5 debug toolbar not shown. the bad thing is, my view screwed.

trying with @dev giving same result as 2.0.6, debug toolbar not shown. and my view is rendered good. Now, i am using yii2-debug @dev version, which is master.

@agungsijawir
Copy link
Author

changing yii2 and yii2-debug to master give me same result,

  • debug panel didn't show except when error occured (thrown exception)

@dynasource
Copy link
Member

how does a fresh install of the application (basic/advanced app) of 2.0.10 look like?

@agungsijawir
Copy link
Author

agungsijawir commented Oct 24, 2016

ok, got it. doing debug step-by-step it actually trigger exception
session_write_close(): Session data file is not created by your uid

it caused by:
https://github.com/yiisoft/yii2/blob/master/framework/web/Session.php#L186

        if ($this->getIsActive()) {
            YII_DEBUG ? session_write_close() : @session_write_close();
        }

On Yii2 version 2.0.9, the code looks like this:
https://github.com/yiisoft/yii2/blob/2.0.9/framework/web/Session.php#L175

        if ($this->getIsActive()) {
            @session_write_close();
        }

Here the commit that caused it:
yiisoft/yii2@7c6f76c

@dynasource
Copy link
Member

@agungsijawir, thanks for sharing. The change matches yiisoft/yii2#10583. Could you check if your answer is in that topic?

@dynasource
Copy link
Member

in specific commit yiisoft/yii2@7c6f76c

@agungsijawir
Copy link
Author

@dynasource yes, since i am using vagrant, i need to change session directory other than @app/runtime to make it work. otherwise, i had to create new class that extends Session class just to make it work on 2.0.10.

the thing is, i didn't use redis/memcached, it just simple apps.

thank you for your assistance, have a nice day!

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

2 participants