Yii Framework Forum: Gii fails to generate model with timeout - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Gii fails to generate model with timeout Rate Topic: -----

#1 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,197
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 30 November 2010 - 06:31 AM

Hi there,

Today I found a bit strange situation to me. I opened Gii installed inside my website and when tried to use it to generate model for one of my tables I got error: "Maximum execution time of 60 seconds exceeded in D:\Dev\xampp\yii\db\CDbCommand.php on line 364" followed by "Maximum execution time of 60 seconds exceeded in D:\Dev\xampp\yii\web\CHttpSession.php on line 108". It repeats, so right now I'm unable to generate Model, for the first time in whole Yii history!

The strangest part is that both DB connection is 100% properly configured and communication to server and DB works like a charm, because seconds after error message from Yii I go to my webapp main page, where in view I wrote a sample SQL statement to test if everything is OK with DB, connection and configuration (I know that using SQLs in view is a very bad manner, but it was just a temporal test).

In other words - I can use my website normally, connection to DB works, results from DB are generated within nanoseconds (all right, I'm kidding, but really fast) and in the same time Gii failes to generate really simple model (table with four columns and three records) with 60 seconds timeout.

I have no bloody idea, what can be wrong? :( Can it be that this strange Gii behaviour is related to using Oracle as RDBMS (never used Gii on it before, always on SQLite or MySQL)? Or that table name contains underscore (_) in name <-- that suspicion is made after attempt with using Giix instead of Gii. It failed too, but not with timeout only with error message that... DB table name can only contain letters, dots and optional asterisk at the end.

Has anyone run into the same situation? Is there anything I can do right now or the only solution left to me is to write model classes by hand?
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 30 November 2010 - 06:53 AM

The 60 seconds timeout is the default PHP timeout for executing scripts...

It means that some part of your script is very very slow... could be the database connection that is slow?

You can increase this timeout in php.ini
Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,197
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 30 November 2010 - 08:08 AM

View Postmdomba, on 30 November 2010 - 06:53 AM, said:

The 60 seconds timeout is the default PHP timeout for executing scripts...

Yes, I'm aware of that.

View Postmdomba, on 30 November 2010 - 06:53 AM, said:

It means that some part of your script is very very slow... could be the database connection that is slow?

Since I'm using Gii, there are no parts of my code. Gii is hanging with timeout. Rest of webpage works fast, with no problems. Therefore I think that this has to be something different, than connection to database. DB is on the same computer as Yii app (accessed locally via localhost). And I'm able to display whole WWW_USERS table within less then one second, while Gii can't create model for this table within 60 seconds. This must be something different, but what?

View Postmdomba, on 30 November 2010 - 06:53 AM, said:

You can increase this timeout in php.ini

Yes, I know. But in my opinion this will not change anything as rest of the page works fine only Gii hangs with timeout.

P.S.: It hangs on Preview stage. I wasn't even able to go to actual file creation step.
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#4 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 30 November 2010 - 08:24 AM

I don't see other way to this than to debug... line by line... or better method by method... until you find where is the bottleneck... could be that in the end you find something that needs to be improved in Gii :)
Find more about me.... btw. Do you know your WAN IP?
0

#5 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,197
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 30 November 2010 - 10:08 AM

View Postmdomba, on 30 November 2010 - 08:24 AM, said:

I don't see other way to this than to debug... line by line... or better method by method... until you find where is the bottleneck... could be that in the end you find something that needs to be improved in Gii

I would rather say that this is caused by Oracle and ActiveRecord at all. I heard at least five different people saying that I'm mad trying to use PHP with Oracle in ActiveRecord manner and that DAO is the only option. Which, to be honest, makes me sad, as I have to use Oracle and love AR.

I'll do some debug to see if I can find something specific.

For right now I have two additional observations:

  • Connection works for sure, even inside Gii. If I type non-existing table name into Model generator it is handled without any problems and after 2-3 second I receive correct error message saying that table was not found in database.
  • I have strange problems enlarging max_execution_time setting in php.ini. I've set it to 600 seconds but Gii still hangs after only 60 seconds. I've tried to both restart server (Apache2 inside XAMPP 1.7.3) and whole machine running it, with no result - still hanging on 60 seconds, though configuration remains set to 600 seconds. They wrote here that they might be something overwritten in server configuration itself. For example: Apache has a Timeout directive, according to mentioned document. But I can't find neither this nor any other time-related directive inside httpd.conf, therefore I have no idea, why scripts hangs after only 60 seconds.

As I said, I'll try to do some debug.
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#6 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,197
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 08 December 2010 - 11:26 AM

View PostTrejder, on 30 November 2010 - 10:08 AM, said:

As I said, I'll try to do some debug.

I went back to the problem after a week and found out following:

1. I switched my DB (in app configuration) for a moment to MySQL and model generation in Gii went with no problems.
2. Right now (after switching back to Oracle) Gii does not fails with timeout, only displays error message saying "Undefined index: SCHEMA_NAME".

Here is a dump of logging component for above error, if this can say something:

Undefined index: SCHEMA_NAME ({srv_path}\yii\db\schema\oci\COciSchema.php:273)
Stack trace:
#0 {srv_path}\yii\gii\generators\model\ModelCode.php(234): COciSchema->getTables()
#1 {srv_path}\yii\gii\generators\model\ModelCode.php(87): ModelCode->generateRelations()
#2 {srv_path}\yii\gii\CCodeGenerator.php(158): ModelCode->prepare()
#3 {srv_path}\yii\gii\CCodeGenerator.php(61): ModelGenerator->prepare()
#4 {srv_path}\yii\web\actions\CInlineAction.php(50): ModelGenerator->actionIndex()
#5 {srv_path}\yii\web\CController.php(300): CInlineAction->run()
#6 {srv_path}\yii\web\CController.php(278): ModelGenerator->runAction()
#7 {srv_path}\yii\web\CController.php(257): ModelGenerator->runActionWithFilters()
#8 {srv_path}\yii\web\CWebApplication.php(324): ModelGenerator->run()
#9 {srv_path}\yii\web\CWebApplication.php(121): CWebApplication->runController()
#10 {srv_path}\yii\base\CApplication.php(135): CWebApplication->processRequest()
#11 {srv_path}\htdocs\{app_name}\index.php(17): CWebApplication->run()

I'm not that far experienced with gii and yii core code, but it seems to me that this is a bug in DB component in Oracle Schema, not in my application.

mdomba, can you please tell me if this is worth opening bug ticket?
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#7 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,359
  • Joined: 12-October 09
  • Location:Croatia

Posted 08 December 2010 - 12:54 PM

I don't have oracle, only mysql & postgres, so I can't realy help you much here...

Just checked the COciSchema.php on line 273, I have there the begin of the function findTableName()

Try with the latest Yii from trunk ... there where some fixes about OCI ...
Find more about me.... btw. Do you know your WAN IP?
0

#8 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,197
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 09 December 2010 - 01:57 AM

View Postmdomba, on 08 December 2010 - 12:54 PM, said:

Just checked the COciSchema.php on line 273, I have there the begin of the function findTableName()

Try with the latest Yii from trunk ... there where some fixes about OCI ...

All right, thanks! I'll give it a try.

The only think that surprises me is that only Gii fails on it. I'm using Active Record (as Gii uses, if I'm not mistaken) in the same application and it works very well - i.e. all models and CRUD files I generated with Gii to another project and only adopted to this Oracle application works fine. This would suggest that even if COciSchema reports the error, it should be somewhere inside Gii, not Active Record. Am I right?
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#9 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,197
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 14 December 2010 - 09:34 AM

If someone is interested in this topic, please continue in this Wiki article, where one of possible solutions (for making Gii work and speeding up ActiveRecord on Oracle) is presented.
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#10 User is offline   ricardograna 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 376
  • Joined: 31-March 09
  • Location:Manaus/AM - Brazil

Posted 01 September 2011 - 10:55 PM

Use cache.

The first try on Gii will fail, but it will build the cache.

The next attempts will work like a charm!
Yes, It Is!
0

#11 User is offline   Trejder 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,197
  • Joined: 06-October 10
  • Location:Southern Poland

Posted 07 September 2011 - 07:39 AM

About using cache I answered in article (as comment to it).

I'm not pretty sure, if this is a good idea to saying users that something is not working, because you're not using cache? Cache isn't obligatory or mandatory to be used in every project and Gii should work also without it for Oracle. Sorry, but I find is as a bug and that is why I reported it here to gather more information about it.
Proud Cookbook author, though still learning powerful Yii! :] See my generic profile for more information. Cheers!
0

#12 User is offline   brecht 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 17-May 11

Posted 23 September 2011 - 09:12 AM

Hello,

Is this problem now solved in Yii or is solution provided?

I have the time-out error on creating a model with Gii (yii-1.1.7.r3135) from a table in an Oracle (11g) database.

These are the dll's i have (not) enabled in php.ini:

;extension=php_oci8.dll
extension=php_oci8_11g.dll
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
extension=php_pdo_oci.dll

'looks' ok, but i am not sure.

Brecht
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users