Code Monkey home page Code Monkey logo

Comments (2)

Zhaars avatar Zhaars commented on July 29, 2024

Hello @devendermishra!

Thanks for reaching out!

Unfortunately, based on the information you provided, it's challenging to thoroughly analyze the issue. The problem seems to have multiple aspects, and it could potentially be on your end, possibly due to incorrect network settings.

To assist you more effectively, could you please provide additional details or steps to reproduce the problem? Additionally, providing a complete Acra log with details of the error you encountered, preferably using the -d flag, would be helpful.

from acra.

devendermishra avatar devendermishra commented on July 29, 2024

Thanks Zhaars for helping out.

Log after -d flag:

time="2024-02-13T03:29:08Z" level=debug msg="New packet" client_id=StashfinID deprecate_eof=false proxy=client sequence_number=0 session_id=1583
time="2024-02-13T03:29:08Z" level=debug msg="New packet" client_id=StashfinID deprecate_eof=false proxy=client sequence_number=0 session_id=1584
time="2024-02-13T03:29:08Z" level=debug msg="Can't read packet from server" client_id=StashfinID session_id=1582
time="2024-02-13T03:29:08Z" level=debug msg="Stop to proxy" client_id=StashfinID interrupt_side=Client-AcraServer session_id=1582
time="2024-02-13T03:29:08Z" level=debug msg="EOF connection closed" client_id=StashfinID interrupt_side=Client-AcraServer session_id=1582
time="2024-02-13T03:29:08Z" level=info msg="Closing client's connection" client_id=StashfinID interrupt_side=Client-AcraServer session_id=1582
time="2024-02-13T03:29:08Z" level=debug msg="Close acra-connector connection" client_id=StashfinID session_id=1582
time="2024-02-13T03:29:08Z" level=debug msg="Close db connection" client_id=StashfinID session_id=1582
time="2024-02-13T03:29:08Z" level=debug msg="All connections closed" client_id=StashfinID session_id=1582
time="2024-02-13T03:29:08Z" level=debug msg="Second proxy goroutine stopped" client_id=StashfinID error="AcraServer-Database:read tcp 172.31.12.255:54358->172.31.35.209:3306: use of closed network connection" interrupt_side=Client-AcraServer session_id=1582
time="2024-02-13T03:29:08Z" level=info msg="Finished processing client's connection" client_id=StashfinID interrupt_side=Client-AcraServer session_id=1582
time="2024-02-13T03:29:08Z" level=debug msg="Close connections on CommandQuit command" client_id=StashfinID deprecate_eof=false proxy=client sequence_number=0 session_id=1583
time="2024-02-13T03:29:08Z" level=debug msg="Can't read packet from server" client_id=StashfinID session_id=1583
time="2024-02-13T03:29:08Z" level=debug msg="Stop to proxy" client_id=StashfinID interrupt_side=AcraServer-Database session_id=1583
time="2024-02-13T03:29:08Z" level=error msg="Network error" client_id=StashfinID code=1100 error="read tcp 172.31.12.255:54360->172.31.35.209:3306: use of closed network connection" interrupt_side=AcraServer-Database session_id=1583
time="2024-02-13T03:29:08Z" level=info msg="Closing client's connection" client_id=StashfinID interrupt_side=AcraServer-Database session_id=1583
time="2024-02-13T03:29:08Z" level=debug msg="Close acra-connector connection" client_id=StashfinID session_id=1583
time="2024-02-13T03:29:08Z" level=debug msg="Close db connection" client_id=StashfinID session_id=1583
time="2024-02-13T03:29:08Z" level=debug msg="Close connections on CommandQuit command" client_id=StashfinID deprecate_eof=false proxy=client sequence_number=0 session_id=1584
time="2024-02-13T03:29:08Z" level=debug msg="Can't read packet from server" client_id=StashfinID session_id=1584
time="2024-02-13T03:29:08Z" level=debug msg="Stop to proxy" client_id=StashfinID interrupt_side=AcraServer-Database session_id=1584
time="2024-02-13T03:29:08Z" level=error msg="Network error" client_id=StashfinID code=1100 error="read tcp 172.31.12.255:54376->172.31.35.209:3306: use of closed network connection" interrupt_side=AcraServer-Database session_id=1584
time="2024-02-13T03:29:08Z" level=info msg="Closing client's connection" client_id=StashfinID interrupt_side=AcraServer-Database session_id=1584
time="2024-02-13T03:29:08Z" level=debug msg="Close acra-connector connection" client_id=StashfinID session_id=1584
time="2024-02-13T03:29:08Z" level=debug msg="Close db connection" client_id=StashfinID session_id=1584
time="2024-02-13T03:29:08Z" level=debug msg="All connections closed" client_id=StashfinID session_id=1583
time="2024-02-13T03:29:08Z" level=debug msg="Second proxy goroutine stopped" client_id=StashfinID error="Client-AcraServer:EOF" interrupt_side=AcraServer-Database session_id=1583
time="2024-02-13T03:29:08Z" level=info msg="Finished processing client's connection" client_id=StashfinID interrupt_side=AcraServer-Database session_id=1583
time="2024-02-13T03:29:08Z" level=debug msg="All connections closed" client_id=StashfinID session_id=1584
time="2024-02-13T03:29:08Z" level=debug msg="Second proxy goroutine stopped" client_id=StashfinID error="Client-AcraServer:EOF" interrupt_side=AcraServer-Database session_id=1584
time="2024-02-13T03:29:08Z" level=info msg="Finished processing client's connection" client_id=StashfinID interrupt_side=AcraServer-Database session_id=1584

Main issue seems db connection leaks.

Infra details:
RDS: Aurora cluster (t4g.medium)
Acra server: 2 (one as reader and another one as writer) in t3.small and t2.small
OS: Ubuntu 20.04, acra installed using package manager in Ubuntu
Applications: 3 PHP applications (PHP 7.2 and CodeIgniter 3), 6 Python applications (using FastApi and Sqlalchemy 2), 4 golang applications.

Python and golang applications use connection pool. PHP applications does not use connection pool. They create connection for every query.

Screenshot from 2024-02-13 09-03-13
Acra was introduced around 15:00 hours. Till midnight, everything was fine. However, after midnight, there is spike in number of connections.

Acra server is running with following options:

-client_id ${ACRA_CLIENT_ID} -db_host $DB_HOST -db_port 3306 -d --incoming_connection_close_timeout=10 --http_api_enable=true -mysql_enable --v -keys_dir keystore/stashfin -encryptor_config_file encryptor_config.yml

To reproduce, you can write sample 2-3 PHP applications using codeigniter with DB configuration as follows:

$db['db_write']['hostname'] = '<acra_host>';
$db['db_write']['username'] = '<user>';
$db['db_write']['port'] = 9393;
$db['db_write']['password'] = 'password';
$db['db_write']['database'] = 'db_name';
$db['db_write']['dbdriver'] = 'mysqli';
$db['db_write']['dbprefix'] = '';
$db['db_write']['pconnect'] = false;
$db['db_write']['db_debug'] = true;
$db['db_write']['db_debug_exception'] = true;
$db['db_write']['cache_on'] = false;
$db['db_write']['cachedir'] = '';
$db['db_write']['char_set'] = 'utf8';
$db['db_write']['dbcollat'] = 'utf8_general_ci';
$db['db_write']['swap_pre'] = '';
$db['db_write']['autoinit'] = true;
$db['db_write']['stricton'] = false;

Sample query code:

$this->db->select("concat(first_name,' ',coalesce(middle_name,''),' ',coalesce(last_name,'')) as customer_name, 
                            email,phone,gender,dob,pan_number,
                            aadhar_number,
                            coalesce(ovd_id, '') as ovd_id,
                            IF(ovd_id IS NULL, 
                                aadhar_number,
                                IF(ovd_id = 1, ovd_number, ovd_number)
                            ) AS ovd_number,
                            coalesce(se.is_active,'0') as stashfin_employee");
        $this->db->from('customer_detail as cd');
        $this->db->join('employee as e', 'e.customer_id=cd.id', 'left');
        $this->db->where('cd.id', $customer_id);
        $data = $this->db->get()->row_array();
        ```
You can do many queries. Create load on these APIs.

from acra.

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.