<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>132145</bug_id>
          
          <creation_ts>2014-04-24 14:21:05 -0700</creation_ts>
          <short_desc>ASSERTION FAILED: &quot;currentPageSize || !m_db&quot; in fast/workers/storage/use-same-database-in-page-and-workers.html</short_desc>
          <delta_ts>2024-04-12 03:48:14 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>ASSIGNED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Lam">mark.lam</reporter>
          <assigned_to name="Mark Lam">mark.lam</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1003775</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2014-04-24 14:21:05 -0700</bug_when>
    <thetext>Build a debug build of ToT, and run:
$ JSC_slowPathAllocsBetweenGCs=1 DumpRenderTree LayoutTests/fast/workers/storage/use-same-database-in-page-and-workers.html

You will see the following assertion failure:

Thread 30 Crashed:: WebCore: Database
0   com.apple.JavaScriptCore      	0x000000010cb00fca WTFCrash + 42 (Assertions.cpp:333)
1   com.apple.WebCore             	0x000000010fecbf5f WebCore::SQLiteDatabase::setMaximumSize(long long) + 127 (SQLiteDatabase.cpp:186)
2   com.apple.WebCore             	0x000000010feda167 WebCore::SQLTransactionBackend::openTransactionAndPreflight() + 503 (SQLTransactionBackend.cpp:584)
3   com.apple.WebCore             	0x000000010fedcc06 WebCore::SQLTransactionStateMachine&lt;WebCore::SQLTransactionBackend&gt;::runStateMachine() + 342 (SQLTransactionStateMachine.h:104)
4   com.apple.WebCore             	0x000000010fedbad2 WebCore::SQLTransactionBackend::performNextStep() + 34 (SQLTransactionBackend.cpp:519)
5   com.apple.WebCore             	0x000000010e73cb6d WebCore::DatabaseBackend::DatabaseTransactionTask::doPerformTask() + 45 (DatabaseTask.cpp:187)
6   com.apple.WebCore             	0x000000010e73c6ad WebCore::DatabaseTask::performTask() + 157 (DatabaseTask.cpp:97)
7   com.apple.WebCore             	0x000000010e73d4d2 WebCore::DatabaseThread::databaseThread() + 274 (DatabaseThread.cpp:198)
8   com.apple.WebCore             	0x000000010e73d34d WebCore::DatabaseThread::databaseThreadStart(void*) + 29 (DatabaseThread.cpp:105)
9   com.apple.JavaScriptCore      	0x000000010cb53210 WTF::threadEntryPoint(void*) + 144 (Threading.cpp:68)
10  com.apple.JavaScriptCore      	0x000000010cb53ef8 WTF::wtfThreadEntryPoint(void*) + 296 (ThreadingPthreads.cpp:168)
11  libsystem_pthread.dylib       	0x00007fff863fe899 _pthread_body + 138
12  libsystem_pthread.dylib       	0x00007fff863fe72a _pthread_start + 137
13  libsystem_pthread.dylib       	0x00007fff86402fc9 thread_start + 13

frame #1: 0x0000000103e30f5f WebCore`WebCore::SQLiteDatabase::setMaximumSize(this=0x000000010b510328, size=5193728) + 127 at SQLiteDatabase.cpp:186
   183 	    
   184 	    int currentPageSize = pageSize();
   185 	
-&gt; 186 	    ASSERT(currentPageSize || !m_db);
   187 	    int64_t newMaxPageCount = currentPageSize ? size / currentPageSize : 0;
   188 	    
   189 	    MutexLocker locker(m_authorizerLock);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1003777</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2014-04-24 14:22:11 -0700</bug_when>
    <thetext>&lt;rdar://problem/16717279&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2028041</commentid>
    <comment_count>2</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-04-12 03:48:14 -0700</bug_when>
    <thetext>This test was removed in below comment in 2015 - https://github.com/WebKit/WebKit/commit/1b267949c79a5f6f2ee6b1550c9673c2fb698139

Although we still have this ASSERT:

https://searchfox.org/wubkat/rev/8ce70fa03821ea1c7a19a3913730ffe6b8a522ed/Source/WebCore/platform/sql/SQLiteDatabase.cpp#363

void SQLiteDatabase::setMaximumSize(int64_t size)
{
    if (size &lt; 0)
        size = 0;
    
    int currentPageSize = pageSize();

    ASSERT(currentPageSize || !m_db);
    int64_t newMaxPageCount = currentPageSize ? size / currentPageSize : 0;
    
    Locker locker { m_authorizerLock };
    enableAuthorizer(false);

    auto statement = prepareStatementSlow(makeString(&quot;PRAGMA max_page_count = &quot;, newMaxPageCount));
    if (!statement || statement-&gt;step() != SQLITE_ROW)
        LOG_ERROR(&quot;Failed to set maximum size of database to %lli bytes&quot;, static_cast&lt;long long&gt;(size));

    enableAuthorizer(true);

}</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>