I installed heartbeat on a new 7.8 site and enabled the "site activity" block on the home page. It shows fine for the admin but a visitor or another authenticated user gets this message:
PDOException: You cannot serialize or unserialize PDO instances in DrupalDatabaseCache->set() (line 418 of .../includes/cache.inc).

I have enabled the permissions to view the streams.
Enabling the useractivity block causes the same error for the same roles.


Andy1966uk’s picture

Did you get a reply here ? I have the same issue

Stalski’s picture

Status: Active » Needs review

This should be fixed in dev. Can you check this and close it if the problem went away?

Stalski’s picture

Status: Needs review » Closed (fixed)
Liliplanet’s picture

Hi Stalski,

Sorry came across the same issue: 'site activity block' shows fine for admin but not authenticated or custom role.

In the block permissions, if set to only admin all is fine, the moment you open permissions to other roles get:

PDOException: You cannot serialize or unserialize PDO instances in cache_set() (line 137 of /home/public_html/includes/cache.inc).

Display Suite installed as per your suggestion :) Thank you so much Stalski.

Liliplanet’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Closed (fixed) » Active

Hoping the following thread might help ..


Stalski’s picture

Really can't reproduce

Stalski’s picture

Status: Active » Postponed (maintainer needs more info)

You'll need to provide steps from a fresh installation on how I can reproduce this.

michellezeedru’s picture

I have a fresh installation of Heartbeat 7.x-1.0 and am experiencing the same error when trying to place the Site Activity block on a page. It appears fine as a tab on the user profile, but not as a block. For me, however, it didn't matter what the permission setting on that block was - it always showed the error.

I also tried using 7.x-1.x-dev, but had the same result.

However, I found that if I didn't set this as a block, but installed used the Context module to have the Site Activity block appear on a certain page, there was no error and the stream appeared as it should.

I hope this is helpful - let me know if there's any more information I can provide for troubleshooting.

Stalski’s picture

I really can't reproduce this. I tried everything I can imagine ...

For the last comment, maybe something broke in the 1.0 version. Maybe start with the dev version from the start.

brinx’s picture

This only happens when you use heartbeat as a drupal block. I have multiple heartbeat stream blocks. This only seems to happen to the one that I use on the user profile page. I've had this happen to me about 4 times in the span of a month. Luckily these were on a local dev site. I was able to reload the database.

I later found out that the issue occurs when drupal calls cache_set to cache the heartbeat block. A quick solution is to disable block caching.
However on my production site, I'm not able to disable block cache because I have a few other modules that depends on it. So now I'm worried that this might one day suddenly stop working when the issue pops up.

I'll have to look into the issue again when I get some more time.

BTW, I tried multiple versions of heartbeat. The issue still occurs

Stalski’s picture

Thanks for the explanation. I'll check it with the data you gave.

Stalski’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

This is not a problem of heartbeat I persume. Found at least this one: #977460: Cannot serialize or unserialize PDO instances error and it seems closed.

fraweg’s picture

Hello Stalski,

with the latest dev-version (6.4.2012) I have a "PDOException" too. You mean this is a drupal core issue?

This is not a problem of heartbeat I persume. Found at least this one: #977460: Cannot serialize or unserialize PDO instances error and it seems closed.

Here is my error message when I will save the user profile:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'in_group' in 'field list': INSERT INTO {heartbeat_activity} (message_id, nid, uid, nid_target, uid_target, cid, access, timestamp, language, variables, in_group) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10); Array ( [:db_insert_placeholder_0] => heartbeat_edit_account [:db_insert_placeholder_1] => 0 [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 4 [:db_insert_placeholder_7] => 1333807135 [:db_insert_placeholder_8] => en [:db_insert_placeholder_9] => !username=|=<a href="http:..../user/1" class="user-link">admin</a>-|- [:db_insert_placeholder_10] => 0 ) in HeartbeatActivity->log_message() (line 528 of /home/..../sites/all/modules/heartbeat/includes/heartbeatactivity.inc).

With the Version "7.x-1.0+83-dev" I did not have this problem.

@ brinx, michellezeedru, Liliplanet, Andy1966uk.. Did you solve the problem?

Best regards,

Edit: Sorry I see this issue "http://drupal.org/node/1511750" to late.. So at first I will apply that patch.

Stalski’s picture

This is issue is a core issue.

What you mention is a total different error and has nothing to do with cache.set. The reason why you get the in_group error is because there is an update hook you did not run or some other update did not work for you. The field DOES exist in latest dev, so much I am sure of.

So before, the in_group error did not happen since the field was not there to begin with. This should work as designed.

fraweg’s picture

Hallo Stalski,

Thanks for your fast answer! I do not really understand what your answer should say me. Sorry my English is a little bit poor. But I have apply your patch from this thread:
and the error message is gone and seems to work. Thanks for that patch!

Best regards

Edit: On the actual (16.4.2012) dev I have still this problem. Can the patch placed into the heartbeat code?

pipep’s picture

I just got the same original issue on D7.14 and heartbeat7.x-1.0. Im using the default site-activity block, with rules and a few other things.

For me the problem appeared while configuring boost.

I think the conflict is that hearbeat tries to refresh while boost is trying to cache, something that is not needed for me, so the problem was immediately fixed after disabling cache for heartbeat.

Liliplanet’s picture

Status: Closed (duplicate) » Active

Just would like to mention that the error still exists for me.

The only way to make it work is to disable block caching in admin/config/development/performance

Is there perhaps a chance of disabling cache for site activity block only?

Most appreciated :)

aborigeno’s picture

Same issue, I've managed a temporary solution changing the block_info hook to not cache any of heartbeat blocks:

 307 /**
 308  * Implements hook_block_info().
 309  */
 310 function heartbeat_block_info() {
 312   $blocks = array();
 313   $streams = heartbeat_stream_config_load_all(TRUE);
 315   // A block for each stream.
 316   foreach ($streams as $key => $stream_config) {
 317     if ($stream_config->has_block) {
 318       $blocks[$stream_config->class]['info'] = drupal_ucfirst($stream_config->title);
 319       $blocks[$stream_config->class]['cache'] = DRUPAL_NO_CACHE;                             // <-- add this line
 320     }
 321   }
 323   // Heartbeat most active users.
 324   $blocks['heartbeat_active_users']['info'] = t('Heartbeat most active users');
 325   $blocks['heartbeat_active_users']['cache'] = DRUPAL_NO_CACHE;                              // <--- also add this if you need to disable active users block 
 326   return $blocks;
 328 }

I'm using custom streams, not so sure if that work on default activity stream.

Maybe an option should be in strams definition array to declare block cache settings ?

adammalone’s picture

Just a comment agreeing with #18 that specifying DRUPAL_NO_CACHE allows the page to load.

I've not had a chance to try this on a clean install so it is possible that something somewhere is causing the issue other than heartbeat.

j_nunes’s picture

I have two browsers, side by side, one for user 1 and another for authenticated user. Whenever I tick "View activity in Site activity" permission's checkbox, the stack goes down and authenticated users see nothing but the error. In my case it was line 450 includes/cache.inc