Thursday, November 25, 2010

Re: CakePHP Model uses the wrong fields in SQL statements!

On Nov 25, 6:34 pm, John Steele <john.david.ste...@gmail.com> wrote:
> On Nov 25, 4:11 am, AD7six <andydawso...@gmail.com> wrote:
>
> > What a lot of noise in this thread (and most likely FUD) :)
>
> Sir,

Should I be wearing in a tie :)

> When customer data starts disappearing seemingly at random, I have a
> serious problem. I am modest. I assumed the error was mine. I've spent
> many hours, both company time and personal, tracking down this bug. I
> have found a problem affecting CakePHP and have attempted to describe
> it as simply and precisely as I can to those most likely to find a
> solution.
>
> > all the above proves is that the 100th - 200th sql query you
> > launched .... are irrelevant. The sql query log doesn't log anything
> > more than the first 200 queries and you aren't clearing it so you are /
> > not/ looking at the last 100 queries you launched - as you've
> > apparently noted but still posted the irrelvant sql.
>
> In my second post, I had noticed my error. I had assumed that
> _queriesLog was a FIFO. The documentation on this point is unclear.
> This was remedied in my 3rd post:
>
> > add this line to the end of the for loop to get the correct query log:
> >                         $dbo->_queriesLog = array_slice($dbo->_queriesLog, -100);
> > I find the numbers you present supicious - e.g. are you running out of
> > auto increment ids - that'd be my start point.
>
> The production application where I first noticed this is using UUIDs.
> In this test, I'm using Integers
>
> From my second post:
>
> > var_dump($this->Foo->_schema);
> ...
> > array(3) {
> >   ["id"]=>
> >   array(5) {
> >     ["type"]=>
> >     string(7) "integer"
>
> MySQL Signed Integers have an upper limit of 2147483647.
> MySQL starts it's auto increment counter at 1.
> The test is performed on a freshly created database table.
>
> x = 128919
> x < 2147483647

Your logic is most likely flawed.

mysql> create table foo ( id tinyint(7) );
mysql> show create table foo;
+-------
+------------------------------------------------------------------------------------------
+
| Table | Create
Table
|
+-------
+------------------------------------------------------------------------------------------
+
| foo | CREATE TABLE `foo` (
`id` tinyint(7) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
+-------
+------------------------------------------------------------------------------------------
+
1 row in set (0.00 sec)
mysql> insert into foo (id) values (1000000);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> select * from foo;
+------+
| id |
+------+
| 127 |
+------+
1 row in set (0.00 sec)


>
> > "my best guess would be a memory leak or overflow somewhere within PHP
> > itself. "
>
> > why would you conclude that? Extraordinary claims require
> > extraordinary irrefutable proof - which is missing.
>
> "My best guess" most certainly is not meant to infer "extraordinary
> claim".

Are you be happier with wild speculation? :)

> It just seems very unlikely that such a subtle bug would be
> caused by a script, that is, Cake, which does not have direct access
> to memory. PHP or one of it's libraries seems more likely.
>
> As for proof... I am not a developer on the CakePHP project. I am not
> a developer on the PHP project. I assume there are readers of this
> group who are. So, proof is left as an exercise for the reader.

If <random person wanting to help> ran your script, which isn't
possible because there's no means to do so (it's not self sufficient,
there's no schema for examlpe), would they find exactly the same
behavior as you?

>
> > FWIW/For info I've (as I'm sure have many) run many batch processes
> > inserting hundreds of thousands or millions of rows at a time.
>
> As have I, and I have not noticed a bug while doing so.

So, if only some of your shells generate this error, and some don't -
what conclusion can you draw about that? <- rhetorical

IME You'll eventually an inevitably find something app specific that's
causing this.

AD

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: