Code Monkey home page Code Monkey logo

Comments (5)

NathanFreeman avatar NathanFreeman commented on June 11, 2024

Do you instantiate a new database connection for each request or do you retrieve it from a database connection pool?
If you are retrieving the database connection from a connection pool, you may need to attempt a reconnection when disconnected.

from swoole-src.

parsibox avatar parsibox commented on June 11, 2024

Do you instantiate a new database connection for each request or do you retrieve it from a database connection pool? If you are retrieving the database connection from a connection pool, you may need to attempt a reconnection when disconnected.

i use separate pdo connection in each Coroutine
i think some function like ksort , sort or fetch big data from mysql blocked whole my file

from swoole-src.

moroswitie avatar moroswitie commented on June 11, 2024

when my query have more than 30000 result mysql say PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

my time_wait and other config on mysql is set but we get error on this step i think when we use fetchAll or foreach or some other function that take long time whole of our Coroutine blocked for that process is it true? if it is true how can we fix this problem?

It sounds like you need to increase "max_allowed_packet" in your mysql config my.ini

from swoole-src.

jingjingxyk avatar jingjingxyk commented on June 11, 2024

Try to reconnect to the database.
reference

  1. #4131 (comment)
  2. #2041
  3. https://github.com/swoole/swoole-wiki/blob/master/doc/15.11%20-%20MySQL%E7%9A%84%E8%BF%9E%E6%8E%A5%E6%B1%A0%E3%80%81%E5%BC%82%E6%AD%A5%E3%80%81%E6%96%AD%E7%BA%BF%E9%87%8D%E8%BF%9E.md
  4. #4141
  5. #5143

最佳的方案是进行断线重连

from swoole-src.

matyhtf avatar matyhtf commented on June 11, 2024

You should catch this exception and reconnect to the MySQL server after disconnection.

from swoole-src.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.