Hey everyone,

I added a radioactivity field to one of my node types but these node don't heat up when they are viewed. I set the initial energy to 100 and the 'view incident energy' to 10. However, the energy stays at 100, no matter how many times the node is viewed. It is only reduced when crons is run.

I also use the field permissions module. For debugging purposes, I gave all user roles (even anonymous users) full permission to create, edit and view the radioactivity field. So I don't think that field permissions causes the problem.

CommentFileSizeAuthor
#16 1792750-minimal-16.patch375 bytespwolanin

Comments

semei’s picture

Also, I set the initial energy to 100, half life to 1800 (=30 minutes), decay granularity to 60, energy cut-off to 0.1 (using live storage).

But when I run cron after 2 minutes, the energy already drops down from 100 to 10.9534!

semei’s picture

Is anyone experiencing similar unexpected behaviors?

semei’s picture

Component: Miscellaneous » Code
jaxxed’s picture

Semei, Can you please export your content-type so that we can see your field configuration.

DerTobi75’s picture

Do you use the Entity Cache Modules?!

Regards,

Tobi

combicart’s picture

I have the same issue (7.x-2.x-dev). I've selected the default profile (default_now) and added it to the standard Articles node on a blank Drupal installation. The radioactivity value only decrease over time but does not add value when viewing the node.

It's a default Drupal installation with no other modules installed.

gkom’s picture

This happens in my live installation but not in my local installation of the same site (v. 7.x-2.7).
I have checked all the settings multiple times but I can't pin point the problem.

I'm using the "live storage" type and the bootstrap configuration is pretty much the same with my local one:

define('VAR_RADIOACTIVITY_CHECKSUM_SALT', 'my_salt_here');
define('VAR_RADIOACTIVITY_DRUPAL_ROOT', '/home/my_folder/public_html');
define('VAR_RADIOACTIVITY_TEMP_DIR', '/home/my_folder/public_html/tmp');

Permissions for radioactivity-bootstrap.cfg.inc are currently 755.

Any ideas on what might be causing this?

donatasp’s picture

To debug this further you could:

  • Check if you can access /sites/all/modules/radioactivity/emit.php. It should say "Invalid post data - check configuration."
  • When on a node page, check your XHR communication between browser and server -- F12 in Chrome or Firefox with Firebug > Network / Net tab > XHR and look for emit.php
gkom’s picture

Great, thank you.

OK, so, /sites/...../emit.php outputs the "Invalid post data" message.

In Firebug, I get a "400 bad request" on the live website whereas it works fine on the same site locally.

The post data on the live site is the same with the local site:

a:1:{s:4:"Live";a:1:{s:4:"node";a:1:{s:6:"review";a:1:{s:20:"field_energy_monthly";a:1:{s:3:"und";a:1:{i:84;i:10;}}}}}}

However the response is different.

Live site:

HTTP/1.1 400 Bad Request
Date: Tue, 18 Dec 2012 15:45:09 GMT
Server: Apache
X-Powered-By: PHP/5.3.17
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html

Local site:

HTTP/1.1 200 OK
Date: Tue, 18 Dec 2012 15:48:23 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: PHP/5.3.2-1ubuntu4.18
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Keep-Alive: timeout=15, max=83
Connection: Keep-Alive
Content-Type: text/html

Please advise. Thank you very much.

combicart’s picture

Thanks,

Emit.php displays "Invalid post data"

I've also checked the XHR communication. I get the following error in Firebug on the response tab (with 7.x-2.x-dev) and the profile (default_now):

Notice: Undefined index: RadioactivityLiveIncidentStorage in /d7/sites/all/modules/contrib/radioactivity/emit.php on line 30

Fatal error: Call to undefined function _radioactivity_update_energy() in /d7/sites/all/modules/contrib/radioactivity/includes/RadioactivityIncident.inc on line 53
donatasp’s picture

@gkom, unfortunately I don't have apache installed anywhere, but if I would allow myself to guess, I would say that your live site disallows POST requests on emit.php for some reason (I assume GET on live says "Invalid post data..."). Check your logs to see if emit.php is actually hit with POST request. My suspicion is on very strict rewrite rules.

@combicart, I was talking about version 2.7. -dev has changed some. Again, I will allow myself to guess and say that you have wrong ..._DRUPAL_ROOT path in your radioactivity-bootstrap.cfg.inc.

Unfortunately, all I can offer now is speculations.

gkom’s picture

I confirm that the request is Post and that a Get request outputs the "invalid post data" message.

The Post data seems to be correct and as a result I assume that everything runs smoothly through radioactivity-bootstrap.inc.

Post data is:

checksum:561c...blahblah
data:a:1:{s:4:"Live";a:1:{s:4:"node";a:1:{s:4:"news";a:1:{s:20:"field_energy_monthly";a:1:{s:3:"und";a:1:{i:281;i:10;}}}}}}

There no incidents in the logs, neither in Drupal's nor the server's. The rewrite rules used are Drupal's default ones. I tested this exact installation on another server (Apache again) and I'm getting the exact same problem.

Is there a more specific test I can run?

Your help is greatly appreciated, thank you.

gkom’s picture

I added a call to stripslashes before generating the checksum in _radioactivity_checksum_generate (radioactivity-bootrstrap.inc) as suggested in Payload validation fails due to escaped quotes and the Post request is now successful.

Request Method:POST
Status Code:200 OK

However, the energy does not increase.

pwolanin’s picture

I am getting with the latest 7.x-2.x the same fatal error mentioned in #10.

pwolanin’s picture

The logic in function _radioactivity_light_initialization() seems to be broken - it doesn't actually bootstrap if the config file exists.

pwolanin’s picture

Status: Active » Needs review
StatusFileSize
new375 bytes

Here's a minimal patch that fixes the fatal for me.

gkom’s picture

I upgraded to the current 7.x-2.x-dev release and I was getting the error mentioned in #10.

The patch provided by pwolanin in #16 took care of the error and the module now works properly.
This patch should be reviewed and committed asap.

Big thanks and happy new year to you all!

tcmug’s picture

Patch #16 is a performance killer - it'll lead to doing a drupal bootstrap every emit.

Real fault lies within emit.php which did not check if the storage class required drupal bootstrap - fixed in latest commit, please give it a go! (As a sidenote emit.php was rewritten about a month ago for the dev branch to support emitter accuracies).

pwolanin’s picture

Sounds like the better fix - I was wondering why the bootstrap required param of each class was not being used.

gkom’s picture

Latest .dev is working nicely. Your quick response is truly appreciated tcmug. Thank you.

rv0’s picture

Version: 7.x-2.7 » 7.x-2.x-dev
Status: Needs review » Fixed

seems to be working so "fixed" is more appropriate

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.