title: Intermittent Room CursorWindowAllocationException on query
body: <p>I have a simple room database with an intermittent bug (with the same dataset), sometimes when running the first query on the database it will crash with CursorWindowAllocationException.</p>
  
  <p>This does not always happen, the majority of the time it doesn't crash with the exact same dataset.</p>
  
  <p>The query being ran is:</p>
  
  <pre><code>@Query("SELECT * FROM history")
  LiveData&lt;List&lt;HistoryEntity&gt;&gt; getAllHistoryLiveData();
  </code></pre>
  
  <p>Exception:</p>
  
  <pre><code>android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. 
      at android.database.CursorWindow.&lt;init&gt;(CursorWindow.java:108)
      at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
      at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:138)
      at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:132)
      at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:220)
      at android.database.AbstractCursor.moveToFirst(AbstractCursor.java:259)
      at androidx.room.RoomOpenHelper.hasRoomMasterTable(RoomOpenHelper.java:156)
      at androidx.room.RoomOpenHelper.checkIdentity(RoomOpenHelper.java:124)
      at androidx.room.RoomOpenHelper.onOpen(RoomOpenHelper.java:116)
      at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.onOpen(FrameworkSQLiteOpenHelper.java:151)
      at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:349)
      at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:238)
      at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableSupportDatabase(FrameworkSQLiteOpenHelper.java:96)
      at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase(FrameworkSQLiteOpenHelper.java:54)
      at androidx.room.RoomDatabase.query(RoomDatabase.java:238)
      at uk.co.flakeynetworks.HistoryDao_Impl$7.compute(HistoryDao_Impl.java:416)
      at uk.co.flakeynetworks.HistoryDao_Impl$7.compute(HistoryDao_Impl.java:402)
      at androidx.lifecycle.ComputableLiveData$2.run(ComputableLiveData.java:101)
  </code></pre>