<p>I am re-reading the MATLAB package that caused me to quit being a neuroscientist and focus on how broken scientific infrastructure was (the first time), and i found my favorite bug of all time - </p><p>code for automated, trial-based behavioral neuroscience experiment:<br />- query a database with hardcoded credentials every time you want to calculate reward/reinforcement size. reward is delivered once per trial max.<br />- yes, hardcoded credentials use the password &quot;password&quot; and formerly exposed a root-level postgres user on public VCS.<br />- query is structurally pointless: the query checks that a value hasn&#39;t changed - the class is named &quot;constantReinforcement&quot;<br />- db connection has a 1s login timeout. connection always times out because db hadn&#39;t existed for ~6 years<br />- if db connection takes longer than 0.3s, send an email to code author saying database access is slow<br />- try to send email with an SMTP server without authentication, remarkably this works for awhile. SMTP server changes to require authentication.<br />- SMTP connection times out. <br />- default timeout is 100 seconds.<br />- rewards in fact calculated between every phase of every trial, not once per trial<br />- 5 phases in trial (6 phase transitions since trial transitions also count as a phase): pre-stimulus, stimulus presentation, pre-reward, reward delivery, post-reward</p><p>so our poor mice were waiting 600 total seconds, 10 minutes, to complete a single trial which should take ~1s. it took two weeks to debug the problem. this was one of about 2 dozen bugs of this nature that defined my first year or two of grad school.</p><p>since this I have seen far worse code in active use running live neuroscientific experiments that get published in the top-tier journals.</p><p>when i first started writing experimental code to fix this, one of the most famous ppl in my field told me not to waste my time because nobody really cares if the code is correct as long as it produces data. i stopped believing all papers and doing neuroscience shortly after.</p>
Attached image 0
Reply