I did a fresh checkout of r1088 and ran ‘rake migrate’ to update. I
believe
that is a migration from 42 to 46. This ran without error. When I
attempt
to view the site I get a message stating: Controller stack got out of
kilter!
I saw this in the log:
Processing ArchivesController#index (for 127.0.0.1 at 2006-07-08
22:01:11)
Blog Load (0.002360) SELECT * FROM blogs ORDER BY id LIMIT 1
Trigger Load (0.000713) SELECT * FROM triggers WHERE (due_at <=
‘2006-07-08 22:01:11’)
Content Load (0.000000) Mysql::Error: You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version
for
the right syntax to use near ‘‘12’’ at line 1: select count(*) as count,
extract(year from published_at)||’ '||lpad(extract(month from
published_at),2,‘0’) as date from contents where type=‘Article’ and
published = 1 and published_at < ‘2006-07-08 22:01:11’ group by date
order
by date desc limit ‘12’
Anybody seen this before? Is the Archives Sidebar broken?
<= ‘2006-07-08 22:01:11’)
Content Load (0.000000) Mysql::Error: You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near ‘‘12’’ at line 1: select
count(*) as count, extract(year from published_at)||’ '||lpad
(extract(month from published_at),2,‘0’) as date from contents
where type=‘Article’ and published = 1 and published_at <
‘2006-07-08 22:01:11’ group by date order by date desc limit ‘12’
Anybody seen this before? Is the Archives Sidebar broken?
I noticed that as well when I upgraded, but haven’t had the time to
track it down. But yeah, I saw the exact same thing.
Yeah. The sidebar configuration makes the limit 12 out ot be String
which
MySQL doesn’t like. I have removed the Archive sidebar for now and the
site
loads correctly. I’ll see if I can patch the Archives Sidebar.
Well the fix for the MySQL error is simple enough just add “to_i” to the
count variable that is passed on line 19 of the archives controller. It
still doesn’t render correctly though:
If that doesn’t work, then can you run this query and send me the
results?
select count(*) as count, extract(year from published_at)||’
'||lpad(extract(month from published_at),2,‘0’) as date from contents
where type=‘Article’ group by date order by date desc limit 5;
1089 resolves the SQL error, but the archives sidebar still renders as
1().
Here is the result of that query:
mysql> select count(*) as count, extract(year from published_at)||’
'> '||lpad(extract(month from published_at),2,‘0’) as date from
contents
-> where type=‘Article’ group by date order by date desc limit 5;
±------±-----+
| count | date |
±------±-----+
| 71 | 1 |
±------±-----+
1 row in set (0.01 sec)
Seems to be something with the || concat. I switched to the function:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.14-standard
mysql> select count(*) as count, concat(extract(year from
published_at),lpad(extract(month from published_at),2,‘0’)) as date
from
contents where type=‘Article’ group by date order by date desc limit 5;
±------±-------+
| count | date |
±------±-------+
| 1 | 200607 |
| 8 | 200606 |
| 7 | 200605 |
| 5 | 200604 |
| 14 | 200603 |
±------±-------+
5 rows in set (0.03 sec)
Is it maybe just an issue on MySQL prior to version 5? Most of the
shared
hosts haven’t upgraded to 5 yet…
Been following this, as I gave up on the archives a while ago, just
didn’t have time to dig into it.
I just tried r1096, and now I see the archives again, though it comes
across as a linked 1 with 460 articles in it. Clicking the link /
articles/find_by_date?month=0&year=1 gives an argument out of range
error
Two things, my theme overrode plugin/sidebars/archives/content.rhtml.
So
that is part of the weirdness. The default archives displays the
aricle_count but the months were still numeric. I changed
line 23 of archives controller to:
:name => “#{entry.year} #{Date::MONTHNAMES[entry.month.to_i]}”,
I’m not sure if this is consider the best/most efficient way to get the
Month name mapped to the int value. Should I have used something like
strftime(’%m’,entry.month.to_i) instead?
Processing ArchivesController#index (for 127.0.0.1 at 2006-07-09
13:08:47)
Blog Load (0.001680) SELECT * FROM blogs ORDER BY id LIMIT 1
Trigger Load (0.000905) SELECT * FROM triggers WHERE (due_at <=
‘2006-07-09 13:08:47’)
Content Load (0.026332) select count(*) as count, extract(year from
published_at) as year,extract(month from published_at) as month from
contents where type=‘Article’ and published = 1 and published_at <
‘2006-07-09 13:08:47’ group by year,month order by year desc,month desc
limit 12
Content Columns (0.000892) SHOW FIELDS FROM contents
Rendering plugins/sidebars/archives/content
mysql> select count(*) as count, extract(year from published_at) as
year,extract(month from published_at) as month from contents where
type=‘Article’ and published = 1 and published_at < ‘2006-07-09
13:08:47’
group by year,month order by year desc,month desc limit 12
→ ;
±------±-----±------+
| count | year | month |
±------±-----±------+
| 1 | 2006 | 7 |
| 8 | 2006 | 6 |
| 7 | 2006 | 5 |
| 5 | 2006 | 4 |
| 14 | 2006 | 3 |
| 9 | 2006 | 2 |
| 5 | 2006 | 1 |
| 7 | 2005 | 12 |
| 9 | 2005 | 11 |
| 5 | 2005 | 10 |
±------±-----±------+
10 rows in set (0.03 sec)
From the FAQ:
Q: Mongrel stops working if it’s left alone for a long time.
If you find that Mongrel stops working after a long idle time and you’re
using MySQL then you’re hitting a bug in the MySQL driver that doesn’t
properly timeout connections. What happens is the MySQL server side of
the
connection times out and closes, but the MySQL client doesn’t detect
this
and just sits there.
What you have to do is set:
ActiveRecord::Base.verification_timeout = 14400
Or to any value that is lower than the MySQL server’s interactive_timeoutsetting. This will make sure that ActiveRecord
checks the connection often
enough to reset the connection.