krvechtivy / php-console

Automatically exported from code.google.com/p/php-console
0 stars 0 forks source link

error with cookies size limit #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1. nginx as frontend
2. many errors in php script
1+2 =  502 Bad Gateway

changes in code resolved truble
[code]
protected static function pushMessageToBuffer($message) {
        self::$messagesSent++;
        $encodedMessageLength = strlen(rawurlencode(json_encode($message)));
        if(self::$bufferLength + $encodedMessageLength > self::cookieSizeLimit) {
         // count & ignore
            self::$messagesIgnored++;
        }elseif(self::$messagesSent <= self::cookiesLimit){
          self::$messagesBuffer[] = $message;
        }
      self::$bufferLength += $encodedMessageLength;
    }

public static function flushMessagesBuffer() {
        if(self::$messagesBuffer) {
            if(self::$bufferLength + $encodedMessageLength > self::cookieSizeLimit) {
                self::$isDisabled = true;
                $message = array('type' => 'error', 'subject' => 'PHP CONSOLE', 'text' => 'COOKIE SIZE LIMIT EXCEEDED. IGNORED MESSAGES : ' .(self::$messagesIgnored) , 'source' => NULL, 'notify' => 3);
                self::sendMessages(array($message));
            }elseif(self::$messagesSent > self::cookiesLimit) {
                self::$isDisabled = true;
                $message = array('type' => 'error', 'subject' => 'PHP CONSOLE', 'text' => 'MESSAGES LIMIT EXCEEDED. IGNORED MESSAGES : ' . (self::$messagesSent-self::cookiesLimit), 'source' => NULL, 'notify' => 3);
                self::sendMessages(array($message));
            }
            self::sendMessages(self::$messagesBuffer);
            self::$bufferLength = 0;
            self::$messagesBuffer = array();
        }
    }
[/code]

Original issue reported on code.google.com by antson1...@gmail.com on 25 May 2011 at 4:43

GoogleCodeExporter commented 9 years ago
Thanks for report. I found that this problem happens when there is a lot of 
errors & redirect, so server send a lot of cookies to browser, and then browser 
sends all of them back to server, but the server cookies limit is smaller than 
browser, so server fails. This also happens on Apache server.

I found solution to fix, it will be in June release.
Thanks for report!

Original comment by barbushin on 26 May 2011 at 7:44

GoogleCodeExporter commented 9 years ago

Original comment by barbushin on 26 May 2011 at 7:45

GoogleCodeExporter commented 9 years ago
Issue 16 has been merged into this issue.

Original comment by barbushin on 23 Jul 2011 at 7:47

GoogleCodeExporter commented 9 years ago
Implemented in PHP Console v3.0 
https://github.com/barbushin/php-console/wiki/PHP-Console-v3-Release-(November-2
013)

Original comment by barbushin on 13 Nov 2013 at 5:28