Closed j-hernandez closed 13 years ago
I knocked the memory limit back down to 128M in php.ini. Loading the page that calls those classes (with LIMIT 2): [Tue Sep 20 13:14:34 2011] [error] [client 192.168.1.40] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 261900 bytes) in /var/www/apps/include/rb.php on line 343
I guess this means that somehow this causes a recursive load action. I.E. your open() function causes the bean to load again which calls the open function etc etc
FYI; tested the code above and that just works.
Its strange though - even after emptying the open() function, I was still receiving the error. Since you're unable to duplicate the issue I'll close it out - perhaps I just needed a break from the keyboard!
Cant you send me the exact code that causes the error? Then I can investigate the issue for you...
Verstuurd vanaf mijn iPhone
Op 23 sep. 2011 om 14:48 heeft j-hernandezreply@reply.github.com het volgende geschreven:
Its strange though - even after emptying the open() function, I was still receiving the error. Since you're unable to duplicate the issue I'll close it out - perhaps I just needed a break from the keyboard!
Reply to this email directly or view it on GitHub: https://github.com/gabordemooij/redbean/issues/86#issuecomment-2178198
I have the same issue on RB 1.5.4 with this code:
public function getQuote()
{
return R::findOne("quote", "posted = ? ", array(false));
}
The quote table has about 50000 records. Bean initialization example:
$quote->qid = $id;
$quote->rating = $rating;
$quote->text = $text;
$quote->posted = false;
Have you tried adding 'LIMIT 1' ?
Thanks, it works with 'LIMIT 1'. But I suggest that "LIMIT 1" should be added to "findOne" method by default, shouldn't it? :)
Do you work in frozen mode? Would be interesting to know if this bug occurs in both situations
Unfortunately adding ' LIMIT 1 ' is almost impossible. RedBeanPHP supports a lot of DB platforms and the LIMIT-statement is not an SQL standard. Also RedBeanPHP has a policy not to touch queries. Instead it allows you to inject snippets, but nothing more. Thanks for the suggestion anyway. I appreciate the feedback. Hopefully we can figure out what causes these issues.
2 classes:
I've tried upping the limit (originally 128M) to 512M in php.ini because initially it was throwing allocated memory exhaustion errors in the logs and tossing up 500 pages.
If I modify the open() function in Model_User above and set the limit to 1, it works fine. As soon as I try to get more than 1 record, I get a segmentation fault (11) in my logs and a dead site. The weird thing is, I made some changes (mostly costmetic) and the code worked fine, then on the next page load, nothing. Haven't been able to get it working since. Really hindering, just going to go back to straight queries.
There's nothing special about my install, I'm in a dev environment running on an Ubuntu VM with 512MB RAM. I'm not asking the scripts to do a lot. Not sure where the hangup is. Will try to get some more info.