Automattic / studio

Studio by WordPress.com, a free desktop app that helps developers streamline their local WordPress development workflow.
https://developer.wordpress.com/studio/
GNU General Public License v2.0
161 stars 17 forks source link

Connecting to Remote MySQL Database Causes Local Site Server to Crash #358

Open dbagley1 opened 1 month ago

dbagley1 commented 1 month ago

Quick summary

When performing actions on sites connected to a remote MySQL database, WASM errors cause runtime errors and the site server crashes. WordPress Studio v1.0.5 on Windows.

Errors were very frequent when trying to create sites connected to a remote MySQL database and the Studio app has to be restarted in order to start the sites again. Any troubleshooting tips and workarounds are appreciated.

Steps to reproduce

I'm working on identifying a concrete set of actions that will always trigger a WASM error, but they've been occur frequently when sending requests to sites connected to a remote MySQL database. Triggering any WASM error caused a runtime error.

  1. Add a site
  2. Configure the site to connect to a remote MySQL database (Documentation) a. Navigate to the wp-content directory and delete the db.php file and the database directory. b. Navigate to the mu-plugins directory and delete sqlite-database-integration-main directory. c. Update wp-config.php file and fill in your MySQL server’s credentials.
  3. Click around the admin dashboard performing common actions like installing plugins and creating posts.

What you expected to happen

I expected an error message to appear in the browser and for the site to continue running on localhost.

What actually happened

The site server stops running, but Studio continues to display the site as "Running" and I'm then unable to stop the site. Clicking the stop button loads for a long time before display the "Something's Broken" error message and prompting the user to restart.

Impact

Some (< 50%)

Available workarounds?

No but the app is still usable

Platform

Windows

Logs or notes

I encountered a variety of WASM errors, including one mentioned in this (WP Playground issue).

Edit: The error log below was output while running the application using the v1.0.5 source code on Node.js v20.9.0. I also tried installing and running the app using WSL (Ubuntu) and encountered the same errors.

ErrorEvent2 {
  type: 'error',
  defaultPrevented: false,
  cancelable: false,
  timeStamp: 40816.1060000062
}
RuntimeError: null function or function signature mismatch
    at mysqlnd_read_header (wasm://wasm/033c9c8e:wasm-function[3937]:0x28d533)
    at mysqlnd_read_packet_header_and_body (wasm://wasm/033c9c8e:wasm-function[1299]:0xb9d80)
    at php_mysqlnd_rset_field_read (wasm://wasm/033c9c8e:wasm-function[10709]:0x5b48cf)
    ... 3 lines matching cause stack trace ...
    at mysqlnd_mysqlnd_command_reap_result_pub (wasm://wasm/033c9c8e:wasm-function[11372]:0x5f7b33)
    at mysqlnd_mysqlnd_conn_data_reap_query_pub (wasm://wasm/033c9c8e:wasm-function[11324]:0x5f4af9)
    at mysqlnd_mysqlnd_conn_data_query_pub (wasm://wasm/033c9c8e:wasm-function[11325]:0x5f4c1f)
    at zif_mysqli_query (wasm://wasm/033c9c8e:wasm-function[8271]:0x4e9fbb)
    at ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (wasm://wasm/033c9c8e:wasm-function[13813]:0x6a9e50)
    at execute_ex (wasm://wasm/033c9c8e:wasm-function[12270]:0x640683)
    at zend_call_function (wasm://wasm/033c9c8e:wasm-function[408]:0x2aa9a)
    at php_replace_in_subject_func (wasm://wasm/033c9c8e:wasm-function[5456]:0x3986f0)
    at preg_replace_func_impl (wasm://wasm/033c9c8e:wasm-function[5342]:0x37ef8b)
    at zif_preg_replace_callback (wasm://wasm/033c9c8e:wasm-function[8103]:0x4cd299) {
  cause: Error
      at Asyncify.handleSleep (...\node_modules\@php-wasm\node\index.cjs:26420:45)
      at _wasm_poll_socket (...\node_modules\@php-wasm\node\index.cjs:25297:21)
      at php_pollfd_for (wasm://wasm/033c9c8e:wasm-function[978]:0x9134f)
      at php_sockop_read (wasm://wasm/033c9c8e:wasm-function[10629]:0x5acff4)
      at php_openssl_sockop_io (wasm://wasm/033c9c8e:wasm-function[5475]:0x3a0ac3)
      at php_openssl_sockop_read (wasm://wasm/033c9c8e:wasm-function[10681]:0x5b3662)
      at _php_stream_fill_read_buffer (wasm://wasm/033c9c8e:wasm-function[3222]:0x20d9b3)
      at _php_stream_read (wasm://wasm/033c9c8e:wasm-function[221]:0x13618)
      at mysqlnd_mysqlnd_vio_network_read_pub (wasm://wasm/033c9c8e:wasm-function[11166]:0x5ea1a3)
      at mysqlnd_mysqlnd_pfc_receive_pub (wasm://wasm/033c9c8e:wasm-function[11272]:0x5f1745)
      at mysqlnd_read_packet_header_and_body (wasm://wasm/033c9c8e:wasm-function[1299]:0xb9e24)
      at php_mysqlnd_rset_field_read (wasm://wasm/033c9c8e:wasm-function[10709]:0x5b48cf)
      at mysqlnd_mysqlnd_res_meta_read_metadata_pub (wasm://wasm/033c9c8e:wasm-function[11230]:0x5ef28b)
      at mysqlnd_mysqlnd_res_read_result_metadata_pub (wasm://wasm/033c9c8e:wasm-function[11228]:0x5ef1bf)
      at mysqlnd_query_read_result_set_header (wasm://wasm/033c9c8e:wasm-function[11156]:0x5e92d7)
      at mysqlnd_mysqlnd_command_reap_result_pub (wasm://wasm/033c9c8e:wasm-function[11372]:0x5f7b33)
}
Error: null function or function signature mismatch
    at #handleRequest (...\node_modules\@php-wasm\node\index.cjs:73301:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async _NodePHP.run (...\node_modules\@php-wasm\node\index.cjs:72995:24)
    at async #dispatchToPHP (...\node_modules\@php-wasm\node\index.cjs:72521:16)
    at async PHPRequestHandler.request (...\node_modules\@php-wasm\node\index.cjs:72433:14)
    at async PHPBrowser.request (...\node_modules\@php-wasm\node\index.cjs:72215:22) {
  cause: Error: Rethrown
      at UnhandledRejectionsTarget.errorListener (...\node_modules\@php-wasm\node\index.cjs:73267:28)
      at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
      at UnhandledRejectionsTarget.dispatchEvent (node:internal/event_target:742:26)
      at runtime.asm.<computed> (...\node_modules\@php-wasm\node\index.cjs:71764:20)
      at invoke_iiiii (...\node_modules\@php-wasm\node\index.cjs:26272:14)
      at php_execute_script (wasm://wasm/033c9c8e:wasm-function[10854]:0x5c16d4)
      at dynCall_ii (wasm://wasm/033c9c8e:wasm-function[12472]:0x64a6d8)
      at ret.<computed> (...\node_modules\@php-wasm\node\index.cjs:25432:33)
      at runtime.asm.<computed> (...\node_modules\@php-wasm\node\index.cjs:71751:18)
      at invoke_ii (...\node_modules\@php-wasm\node\index.cjs:26206:14)
      at wasm_sapi_handle_request (wasm://wasm/033c9c8e:wasm-function[9474]:0x556618)
      at ret.<computed> (...\node_modules\@php-wasm\node\index.cjs:25432:33)
      at runtime.asm.<computed> (...\node_modules\@php-wasm\node\index.cjs:71751:18)
      at Object.doRewind (...\node_modules\@php-wasm\node\index.cjs:25515:14)
      at ...\node_modules\@php-wasm\node\index.cjs:25538:45
      at ...\node_modules\@php-wasm\node\index.cjs:25364:11 {
    cause: RuntimeError: null function or function signature mismatch
        at mysqlnd_read_header (wasm://wasm/033c9c8e:wasm-function[3937]:0x28d533)
        at mysqlnd_read_packet_header_and_body (wasm://wasm/033c9c8e:wasm-function[1299]:0xb9d80)
        at php_mysqlnd_rset_field_read (wasm://wasm/033c9c8e:wasm-function[10709]:0x5b48cf)
        ... 3 lines matching cause stack trace ...
        at mysqlnd_mysqlnd_command_reap_result_pub (wasm://wasm/033c9c8e:wasm-function[11372]:0x5f7b33)
        at mysqlnd_mysqlnd_conn_data_reap_query_pub (wasm://wasm/033c9c8e:wasm-function[11324]:0x5f4af9)
        at mysqlnd_mysqlnd_conn_data_query_pub (wasm://wasm/033c9c8e:wasm-function[11325]:0x5f4c1f)
        at zif_mysqli_query (wasm://wasm/033c9c8e:wasm-function[8271]:0x4e9fbb)
        at ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (wasm://wasm/033c9c8e:wasm-function[13813]:0x6a9e50)
        at execute_ex (wasm://wasm/033c9c8e:wasm-function[12270]:0x640683)
        at zend_call_function (wasm://wasm/033c9c8e:wasm-function[408]:0x2aa9a)
        at php_replace_in_subject_func (wasm://wasm/033c9c8e:wasm-function[5456]:0x3986f0)
        at preg_replace_func_impl (wasm://wasm/033c9c8e:wasm-function[5342]:0x37ef8b)
        at zif_preg_replace_callback (wasm://wasm/033c9c8e:wasm-function[8103]:0x4cd299) {
      cause: Error
          at Asyncify.handleSleep (...\node_modules\@php-wasm\node\index.cjs:26420:45)
          at _wasm_poll_socket (...\node_modules\@php-wasm\node\index.cjs:25297:21)
          at php_pollfd_for (wasm://wasm/033c9c8e:wasm-function[978]:0x9134f)
          at php_sockop_read (wasm://wasm/033c9c8e:wasm-function[10629]:0x5acff4)
          at php_openssl_sockop_io (wasm://wasm/033c9c8e:wasm-function[5475]:0x3a0ac3)
          at php_openssl_sockop_read (wasm://wasm/033c9c8e:wasm-function[10681]:0x5b3662)
          at _php_stream_fill_read_buffer (wasm://wasm/033c9c8e:wasm-function[3222]:0x20d9b3)
          at _php_stream_read (wasm://wasm/033c9c8e:wasm-function[221]:0x13618)
          at mysqlnd_mysqlnd_vio_network_read_pub (wasm://wasm/033c9c8e:wasm-function[11166]:0x5ea1a3)
          at mysqlnd_mysqlnd_pfc_receive_pub (wasm://wasm/033c9c8e:wasm-function[11272]:0x5f1745)
          at mysqlnd_read_packet_header_and_body (wasm://wasm/033c9c8e:wasm-function[1299]:0xb9e24)
          at php_mysqlnd_rset_field_read (wasm://wasm/033c9c8e:wasm-function[10709]:0x5b48cf)
          at mysqlnd_mysqlnd_res_meta_read_metadata_pub (wasm://wasm/033c9c8e:wasm-function[11230]:0x5ef28b)
          at mysqlnd_mysqlnd_res_read_result_metadata_pub (wasm://wasm/033c9c8e:wasm-function[11228]:0x5ef1bf)
          at mysqlnd_query_read_result_set_header (wasm://wasm/033c9c8e:wasm-function[11156]:0x5e92d7)
          at mysqlnd_mysqlnd_command_reap_result_pub (wasm://wasm/033c9c8e:wasm-function[11372]:0x5f7b33)
    },
    betterMessage: 'null function or function signature mismatch'
  }
}
Trace: Error: null function or function signature mismatch
    at #handleRequest (...\node_modules\@php-wasm\node\index.cjs:73301:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async _NodePHP.run (...\node_modules\@php-wasm\node\index.cjs:72995:24)
    at async #dispatchToPHP (...\node_modules\@php-wasm\node\index.cjs:72521:16)
    at async PHPRequestHandler.request (...\node_modules\@php-wasm\node\index.cjs:72433:14)
    at async PHPBrowser.request (...\node_modules\@php-wasm\node\index.cjs:72215:22) {
  cause: Error: Rethrown
      at UnhandledRejectionsTarget.errorListener (...\node_modules\@php-wasm\node\index.cjs:73267:28)
      at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
      at UnhandledRejectionsTarget.dispatchEvent (node:internal/event_target:742:26)
      at runtime.asm.<computed> (...\node_modules\@php-wasm\node\index.cjs:71764:20)
      at invoke_iiiii (...\node_modules\@php-wasm\node\index.cjs:26272:14)
      at php_execute_script (wasm://wasm/033c9c8e:wasm-function[10854]:0x5c16d4)
      at dynCall_ii (wasm://wasm/033c9c8e:wasm-function[12472]:0x64a6d8)
      at ret.<computed> (...\node_modules\@php-wasm\node\index.cjs:25432:33)
      at runtime.asm.<computed> (...\node_modules\@php-wasm\node\index.cjs:71751:18)
      at invoke_ii (...\node_modules\@php-wasm\node\index.cjs:26206:14)
      at wasm_sapi_handle_request (wasm://wasm/033c9c8e:wasm-function[9474]:0x556618)
      at ret.<computed> (...\node_modules\@php-wasm\node\index.cjs:25432:33)
      at runtime.asm.<computed> (...\node_modules\@php-wasm\node\index.cjs:71751:18)
      at Object.doRewind (...\node_modules\@php-wasm\node\index.cjs:25515:14)
      at ...\node_modules\@php-wasm\node\index.cjs:25538:45
      at ...\node_modules\@php-wasm\node\index.cjs:25364:11 {
    cause: RuntimeError: null function or function signature mismatch
        at mysqlnd_read_header (wasm://wasm/033c9c8e:wasm-function[3937]:0x28d533)
        at mysqlnd_read_packet_header_and_body (wasm://wasm/033c9c8e:wasm-function[1299]:0xb9d80)
        at php_mysqlnd_rset_field_read (wasm://wasm/033c9c8e:wasm-function[10709]:0x5b48cf)
        ... 3 lines matching cause stack trace ...
        at mysqlnd_mysqlnd_command_reap_result_pub (wasm://wasm/033c9c8e:wasm-function[11372]:0x5f7b33)
        at mysqlnd_mysqlnd_conn_data_reap_query_pub (wasm://wasm/033c9c8e:wasm-function[11324]:0x5f4af9)
        at mysqlnd_mysqlnd_conn_data_query_pub (wasm://wasm/033c9c8e:wasm-function[11325]:0x5f4c1f)
        at zif_mysqli_query (wasm://wasm/033c9c8e:wasm-function[8271]:0x4e9fbb)
        at ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (wasm://wasm/033c9c8e:wasm-function[13813]:0x6a9e50)
        at execute_ex (wasm://wasm/033c9c8e:wasm-function[12270]:0x640683)
        at zend_call_function (wasm://wasm/033c9c8e:wasm-function[408]:0x2aa9a)
        at php_replace_in_subject_func (wasm://wasm/033c9c8e:wasm-function[5456]:0x3986f0)
        at preg_replace_func_impl (wasm://wasm/033c9c8e:wasm-function[5342]:0x37ef8b)
        at zif_preg_replace_callback (wasm://wasm/033c9c8e:wasm-function[8103]:0x4cd299) {
      cause: Error
          at Asyncify.handleSleep (...\node_modules\@php-wasm\node\index.cjs:26420:45)
          at _wasm_poll_socket (...\node_modules\@php-wasm\node\index.cjs:25297:21)
          at php_pollfd_for (wasm://wasm/033c9c8e:wasm-function[978]:0x9134f)
          at php_sockop_read (wasm://wasm/033c9c8e:wasm-function[10629]:0x5acff4)
          at php_openssl_sockop_io (wasm://wasm/033c9c8e:wasm-function[5475]:0x3a0ac3)
          at php_openssl_sockop_read (wasm://wasm/033c9c8e:wasm-function[10681]:0x5b3662)
          at _php_stream_fill_read_buffer (wasm://wasm/033c9c8e:wasm-function[3222]:0x20d9b3)
          at _php_stream_read (wasm://wasm/033c9c8e:wasm-function[221]:0x13618)
          at mysqlnd_mysqlnd_vio_network_read_pub (wasm://wasm/033c9c8e:wasm-function[11166]:0x5ea1a3)
          at mysqlnd_mysqlnd_pfc_receive_pub (wasm://wasm/033c9c8e:wasm-function[11272]:0x5f1745)
          at mysqlnd_read_packet_header_and_body (wasm://wasm/033c9c8e:wasm-function[1299]:0xb9e24)
          at php_mysqlnd_rset_field_read (wasm://wasm/033c9c8e:wasm-function[10709]:0x5b48cf)
          at mysqlnd_mysqlnd_res_meta_read_metadata_pub (wasm://wasm/033c9c8e:wasm-function[11230]:0x5ef28b)
          at mysqlnd_mysqlnd_res_read_result_metadata_pub (wasm://wasm/033c9c8e:wasm-function[11228]:0x5ef1bf)
          at mysqlnd_query_read_result_set_header (wasm://wasm/033c9c8e:wasm-function[11156]:0x5e92d7)
          at mysqlnd_mysqlnd_command_reap_result_pub (wasm://wasm/033c9c8e:wasm-function[11372]:0x5f7b33)
    },
    betterMessage: 'null function or function signature mismatch'
  }
}
    at ...\.webpack\main\siteServerProcess.js:53952:99
    at Generator.throw (<anonymous>)
    at rejected (...\.webpack\main\siteServerProcess.js:53884:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  WASM ERROR

  "unreachable" WASM instruction executed.

  The typical reason is a PHP function missing from the ASYNCIFY_ONLY
  list when building PHP.wasm.

  You will need to file a new issue in the WordPress Playground repository
  and paste this error message there:

  https://github.com/WordPress/wordpress-playground/issues/new

  If you're a core developer, the typical fix is to:

  * Isolate a minimal reproduction of the error
  * Add a reproduction of the error to php-asyncify.spec.ts in the WordPress Playground repository
  * Run 'npm run fix-asyncify'
  * Commit the changes, push to the repo, release updated NPM packages

  Below is a list of all the PHP functions found in the stack trace to
  help with the minimal reproduction. If they're all already listed in
  the Dockerfile, you'll need to trigger this error again with long stack
  traces enabled. In node.js, you can do it using the --stack-trace-limit=100
  CLI option:

      * php_pollfd_for
      * php_sockop_read
      * php_openssl_sockop_io
      * php_openssl_sockop_read
      * _php_stream_fill_read_buffer
      * _php_stream_read
      * mysqlnd_mysqlnd_vio_network_read_pub
      * mysqlnd_mysqlnd_pfc_receive_pub
      * mysqlnd_read_packet_header_and_body
      * php_mysqlnd_rset_field_read
      * mysqlnd_mysqlnd_res_meta_read_metadata_pub
      * mysqlnd_mysqlnd_res_read_result_metadata_pub
      * mysqlnd_query_read_result_set_header
      * mysqlnd_mysqlnd_command_reap_result_pub

wasm://wasm/033c9c8e:1

RuntimeError: unreachable
    at dynCall_iiiii (wasm://wasm/033c9c8e:wasm-function[12469]:0x64a48e)
    at ret.<computed> (...\node_modules\@php-wasm\node\index.cjs:25432:33)
    at runtime.asm.<computed> (...\node_modules\@php-wasm\node\index.cjs:71751:18)
    at invoke_iiiii (...\node_modules\@php-wasm\node\index.cjs:26272:14)
    at php_execute_script (wasm://wasm/033c9c8e:wasm-function[10854]:0x5c16d4)
    at dynCall_ii (wasm://wasm/033c9c8e:wasm-function[12472]:0x64a6d8)
    at ret.<computed> (...\node_modules\@php-wasm\node\index.cjs:25432:33)
    at runtime.asm.<computed> (...\node_modules\@php-wasm\node\index.cjs:71751:18)
    at invoke_ii (...\node_modules\@php-wasm\node\index.cjs:26206:14)
    at wasm_sapi_handle_request (wasm://wasm/033c9c8e:wasm-function[9474]:0x556618)
    at ret.<computed> (...\node_modules\@php-wasm\node\index.cjs:25432:33)
    at runtime.asm.<computed> (...\node_modules\@php-wasm\node\index.cjs:71751:18)
    at Object.doRewind (...\node_modules\@php-wasm\node\index.cjs:25515:14)
    at ...\node_modules\@php-wasm\node\index.cjs:25538:45
    at ...\node_modules\@php-wasm\node\index.cjs:25364:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  cause: Error
      at Asyncify.handleSleep (...\node_modules\@php-wasm\node\index.cjs:26420:45)
      at _wasm_poll_socket (...\node_modules\@php-wasm\node\index.cjs:25297:21)
      at php_pollfd_for (wasm://wasm/033c9c8e:wasm-function[978]:0x9134f)
      at php_sockop_read (wasm://wasm/033c9c8e:wasm-function[10629]:0x5acff4)
      at php_openssl_sockop_io (wasm://wasm/033c9c8e:wasm-function[5475]:0x3a0ac3)
      at php_openssl_sockop_read (wasm://wasm/033c9c8e:wasm-function[10681]:0x5b3662)
      at _php_stream_fill_read_buffer (wasm://wasm/033c9c8e:wasm-function[3222]:0x20d9b3)
      at _php_stream_read (wasm://wasm/033c9c8e:wasm-function[221]:0x13618)
      at mysqlnd_mysqlnd_vio_network_read_pub (wasm://wasm/033c9c8e:wasm-function[11166]:0x5ea1a3)
      at mysqlnd_mysqlnd_pfc_receive_pub (wasm://wasm/033c9c8e:wasm-function[11272]:0x5f1745)
      at mysqlnd_read_packet_header_and_body (wasm://wasm/033c9c8e:wasm-function[1299]:0xb9e24)
      at php_mysqlnd_rset_field_read (wasm://wasm/033c9c8e:wasm-function[10709]:0x5b48cf)
      at mysqlnd_mysqlnd_res_meta_read_metadata_pub (wasm://wasm/033c9c8e:wasm-function[11230]:0x5ef28b)
      at mysqlnd_mysqlnd_res_read_result_metadata_pub (wasm://wasm/033c9c8e:wasm-function[11228]:0x5ef1bf)
      at mysqlnd_query_read_result_set_header (wasm://wasm/033c9c8e:wasm-function[11156]:0x5e92d7)
      at mysqlnd_mysqlnd_command_reap_result_pub (wasm://wasm/033c9c8e:wasm-function[11372]:0x5f7b33)
}

Node.js v20.9.0
Sentry Logger [error]: Transport disabled
Sentry Logger [error]: Transport disabled
Loaded user data from C:\Users\...\AppData\Roaming\Studio\appdata-v1.json
Saved user data to C:\Users\...\AppData\Roaming\Studio\appdata-v1.json
Stopping server with ID 81d03e79-be19-4fc4-9ddb-1d4c733dc1b4

"Stopping server with ID" was logged after trying to stop the site and was the last log event before the app displayed the "Something's broken" error.

wojtekn commented 1 month ago

Thanks for reporting the issue @dbagley1, we will check it.