Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APIS-945] Fix the core dump error related with CCI Connection Pool #57

Merged
merged 7 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions src/cci/cas_cci.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ int wsa_initialize ();
#define CON_HANDLE_ID_FACTOR 1000000
#define CON_ID(a) ((a) / CON_HANDLE_ID_FACTOR)
#define REQ_ID(a) ((a) % CON_HANDLE_ID_FACTOR)

/************************************************************************
* PRIVATE FUNCTION PROTOTYPES *
************************************************************************/
Expand Down Expand Up @@ -712,25 +713,34 @@ cci_disconnect (int mapped_conn_id, T_CCI_ERROR * err_buf)

get_last_error (con_handle, err_buf);
}
else if (con_handle->broker_info[BROKER_INFO_CCI_PCONNECT] && hm_put_con_to_pool (con_handle->id) >= 0)
{
cci_end_tran_internal (con_handle, CCI_TRAN_ROLLBACK);
API_ELOG (con_handle, 0);

get_last_error (con_handle, err_buf);
con_handle->used = false;
hm_release_connection (mapped_conn_id, &con_handle);
}
else
{
if (con_handle->broker_info[BROKER_INFO_CCI_PCONNECT])
{
cci_end_tran_internal (con_handle, CCI_TRAN_ROLLBACK);

MUTEX_LOCK (con_handle_table_mutex);
if ((con_handle->id >= 1 && con_handle->id <= MAX_CON_HANDLE) && hm_put_con_to_pool (con_handle->id) >= 0)
{
API_ELOG (con_handle, 0);
get_last_error (con_handle, err_buf);
con_handle->used = false;
hm_release_connection (mapped_conn_id, &con_handle);
MUTEX_UNLOCK (con_handle_table_mutex);

return error;
}
MUTEX_UNLOCK (con_handle_table_mutex);
}

error = qe_con_close (con_handle);
API_ELOG (con_handle, error);

set_error_buffer (&(con_handle->err_buf), error, NULL);
get_last_error (con_handle, err_buf);
con_handle->used = false;

MUTEX_LOCK (con_handle_table_mutex);
con_handle->used = false;
hm_delete_connection (mapped_conn_id, &con_handle);
MUTEX_UNLOCK (con_handle_table_mutex);
}
Expand Down
2 changes: 0 additions & 2 deletions src/cci/cci_handle_mng.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@
* PRIVATE DEFINITIONS *
************************************************************************/

#define MAX_CON_HANDLE 2048

#define REQ_HANDLE_ALLOC_SIZE 256

#define CCI_MAX_CONNECTION_POOL 256
Expand Down
3 changes: 3 additions & 0 deletions src/cci/cci_handle_mng.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@

#define REACHABLE true
#define UNREACHABLE false

#define MAX_CON_HANDLE 2048

/************************************************************************
* PUBLIC TYPE DEFINITIONS *
************************************************************************/
Expand Down