catalyst / moodle-tool_excimer

A Moodle tool to find bottlenecks in your code safely in production
https://moodle.org/plugins/tool_excimer
GNU General Public License v3.0
13 stars 9 forks source link

Error while trying to save profile with a read-only database connection. #341

Closed marxjohnson closed 5 months ago

marxjohnson commented 7 months ago

I found this error cropping up in the PHP error log.

Default exception handler: Error writing to database 
Debug: The MySQL server is running with the --read-only option so it cannot execute this statement
INSERT INTO mdl_tool_excimer_profiles (reason,scripttype,method,created,finished,duration,request,scriptgroup,pathinfo,parameters,sessionid,userid,maxstackdepth,cookies,buffering,responsecode,referer,pid,hostname,useragent,versionhash,datasize,numsamples,samplerate,memoryusagedatad3,memoryusagemax,flamedatad3,contenttypecategory,contenttypekey,contenttypevalue,dbreads,dbwrites,dbreplicareads,lockreason,courseid,timecreated,timemodified,usermodified) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
[array (
  0 => 2,
  1 => 2,
  2 => 'GET',
  3 => 1709813015.0,
  4 => 0,
  5 => 90.017918109893799,
  6 => 'report/myfeedback',
  7 => 'report/myfeedback',
  8 => '',
  9 => '',
  10 => '93198731e3',
  11 => '790868',
  12 => 29,
  13 => 1,
  14 => 1,
  15 => 200,
  16 => 'https://moodle/my/'
" while reading upstream, request: "GET /report/myfeedback/index.php HTTP/1.1"

It appears that Excimer is trying to write a profile, but the request is using the read-only database connection for $DB, so it fails. Excimer needs to make sure it uses a read-write connection for saving profiles.

marxjohnson commented 5 months ago

I am no longer seeing this error from excimer, although I am seeing it from another plugin on the same site. I have verified that Excimer always creates a new connection to the read-write database to save profiles. I am closing this issue.