title: sqlite error database is locked when using sqlite3 command line
body: <p>I use sqlite3 command line, from bash.</p>
  
  <p>I spawn multiple processes, all trying to insert into the same sqlite database file.</p>
  
  <p>I often get "database is locked".</p>
  
  <p>According to my reading of documentation (<a href="http://www.sqlite.org/cvstrac/wiki?p=DatabaseIsLocked" rel="noreferrer">http://www.sqlite.org/cvstrac/wiki?p=DatabaseIsLocked</a>) , this should never happen: "SQLITE_LOCKED means the source of contention is internal and comes from the same database connection that received the SQLITE_LOCKED error".</p>
  
  <p>sqlite3 command line is single-threaded, so I would expect SQLITE_BUSY in this situation, but not SQLITE_LOCKED.</p>
  
  <p>Code:</p>
  
  <pre><code>doit() {
     sqlite3 /tmp/db "insert into foo(a,b,c) values(1,2,3);
  }
  
  doit &amp;; doit &amp;; doit &amp;
  </code></pre>
  
  <p>I tried adding PRAGMA busy_timeout=2000; and  PRAGMA locking_mode=EXCLUSIVE; for the heck of it, but it didn't help.</p>
  
  <pre><code>sqlite3 -version
  3.8.9 2015-04-08 12:16:33 8a8ffc862e96f57aa698f93de10dee28e69f6e09
  </code></pre>