title: How to solve "Service has gone away" error and Page not found in Drupal 8?
body: <p>I was building my first Drupal site.  After creating some stuff such as views, blocks, etc... at some point this warnings and errors happened.  I been trying to google every warning and error and no luck yet.  I also checked the "Report Logs" and the only thing I see is <code>Page not found</code>, it shows the same errors and warnings for every page only when I click on <code>Flush all cache</code>.</p>
  
  <p>Pleasee help..</p>
  
  <blockquote>
    <p>The website encountered an unexpected error. Please try again later.
    Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => webprofiler [:db_insert_placeholder_2] => Unable to store the profiler information. [:db_insert_placeholder_3] => a:0:{} [:db_insert_placeholder_4] => 4 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => <a href="http://localhost:8888/drupal-8.1.2/user/1" rel="nofollow">http://localhost:8888/drupal-8.1.2/user/1</a> [:db_insert_placeholder_7] => <a href="http://localhost:8888/drupal-8.1.2/user/1" rel="nofollow">http://localhost:8888/drupal-8.1.2/user/1</a> [:db_insert_placeholder_8] => ::1 [:db_insert_placeholder_9] => 1468798629 ) in Drupal\dblog\Logger\DbLog->log() (line 79 of core/modules/dblog/src/Logger/DbLog.php).</p>
    
    <p>Drupal\dblog\Logger\DbLog->log(4, 'Unable to store the profiler
    information.', Array) (Line: 136)
    Drupal\Core\Logger\LoggerChannel->log(4, 'Unable to store the profiler
    information.', Array) (Line: 81)
    Drupal\Core\Logger\LoggerChannel->warning('Unable to store the
    profiler information.', Array) (Line: 120)
    Symfony\Component\HttpKernel\Profiler\Profiler->saveProfile(Object)
    (Line: 158)
    Symfony\Component\HttpKernel\EventListener\ProfilerListener->onKernelTerminate(Object,
    'kernel.terminate', Object) call_user_func(Array, Object,
    'kernel.terminate', Object) (Line: 61)
    Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(Object,
    'kernel.terminate', Object) (Line: 111)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.terminate',
    Object) (Line: 132)
    Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch('kernel.terminate',
    Object) (Line: 79)
    Symfony\Component\HttpKernel\HttpKernel->terminate(Object, Object)
    (Line: 32) Stack\StackedHttpKernel->terminate(Object, Object) (Line:
    606) Drupal\Core\DrupalKernel->terminate(Object, Object) (Line: 22)</p>
  </blockquote>
  
  <p><strong>Uncaught exception thrown in shutdown function.</strong></p>
  
  <blockquote>
    <p>Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]:
    General error: 2006 MySQL server has gone away: CREATE TABLE
    {cache_default} ( <code>cid</code> VARCHAR(255) BINARY CHARACTER SET ascii
    COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT 'Primary Key:
    Unique cache ID.', <code>data</code> LONGBLOB NULL DEFAULT NULL COMMENT 'A
    collection of data to cache.', <code>expire</code> INT NOT NULL DEFAULT 0 COMMENT
    'A Unix timestamp indicating when the cache entry should expire, or -1
    for never.', <code>created</code> DECIMAL(14, 3) NOT NULL DEFAULT 0 COMMENT 'A
    timestamp with millisecond precision indicating when the cache entry
    was created.', <code>serialized</code> SMALLINT NOT NULL DEFAULT 0 COMMENT 'A
    flag to indicate whether content is serialized (1) or not (0).',
    <code>tags</code> LONGTEXT NULL DEFAULT NULL COMMENT 'Space-separated list of
    cache tags for this entry.', <code>checksum</code> VARCHAR(255) CHARACTER SET
    ascii COLLATE ascii_general_ci NOT NULL COMMENT 'The tag invalidation
    checksum when this entry was saved.', PRIMARY KEY (<code>cid</code>), INDEX
    <code>expire</code> (<code>expire</code>) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4
    COMMENT 'Storage for the cache API.'; Array ( ) in
    Drupal\webprofiler\Cache\CacheBackendWrapper->set() (line 105 of
    /Applications/MAMP/htdocs/drupal-8.1.2/modules/devel/webprofiler/src/Cache/CacheBackendWrapper.php).</p>
    
    <p>Drupal\webprofiler\Cache\CacheBackendWrapper->set('theme_registry:storage:mytheme',
    Array, -1, Array) (Line: 198) Drupal\bootstrap\Utility\Storage->save()
    (Line: 978)
    _drupal_shutdown_function()</p>
  </blockquote>