Welcome Guest, Not a member yet? Register   Sign In
CI controller freezes
#1

[eluser]Unknown[/eluser]
Hi all. This is my first post here, please be easy on me =p

Well, I'm not sure if this is a CI bug or what, or even if this has posted or not... Here we go

CI controller is freezing when other instance of CI is running then only process the other pages when the first finishes. Let explain with code. I created controllers to test these errors:

Code:
class Show extends CI_Controller{

function __construct(){
  parent::__construct();
  die('-' . rand() . '-');
}

}

well, this is a very simple controller...try to run it!
You're saying: Ok... it runs faster then prints a random number on the screen... Fine!

Now try this one:

Code:
class Sleep extends CI_Controller{

function __construct(){
  parent::__construct();  // comment this entire line later
  sleep(20);
  die('end');
}

}

You're thinking: Hmm, this waits for 20 seconds then prints 'end' and finishes the application. So, Whats wrong???

Both of this controllers is doing what they should do... Well, good so far!

Now, open your browser with 2 tabs, each one for these controllers... Now try to run our 'sleep' controller first, then, imediately runs the 'show' controller in the second tab...

What happened to the second tab? did it shows the random number instantly or waits for 'sleep' finishes to do it?

Now try to simply comment the 'parent::__construct();' of 'Sleep' controller. Try to run the same test again. The problem in 'Show' controller persists? No? Why?

What CI is doing in parent::__construct() function that's freezing other instances of controllers?

I'm using latest version of CI, with default configuration... Please help
Thnks in advance




Theme © iAndrew 2016 - Forum software by © MyBB