MySQL Forums
Forum List  »  Connector/C (libmysql)

mysql-connector-c-6.1.6-src/sql/net_serv.cc:196: void net_clear(NET*, my_bool): Assertion `!check_buffer || (vio_pending(net->vio) <= 1)' failed.
Posted by: Ruslan Laishev
Date: December 06, 2016 05:46AM

Hello!

I developing multithreaded application using a MySQL connection pool are shared between a thread workers crew ...

So, I have:

...
{$ASCINI("CALL uai_chkauth2(?, ?, ?, ?, ?)")},




int __db_chkauth2 (
unsigned uid,
char * nonce,
unsigned short nonlen,
char * digest,
unsigned short diglen,
unsigned * flags
)
{
unsigned status = SS$_NORMAL, rc = SS$_ABORT, argc;
DB_CTX * dbctx;
MYSQL_BIND argv[5];
MYSQL_RES * res;
MYSQL_STMT * stmt;
char snonce[128], sdigest[128];

/*
* Convert NoOnce and Digest from internal binary representative into the hex string
*/
nonlen = $BIN2HEX(nonce, snonce, nonlen);
diglen = $BIN2HEX(digest, sdigest, diglen);

/* Declare input & output parameters ... */
memset(&argv, 0, sizeof(argv));
memset(&argv, 0, sizeof(argv));

argv[argc = 0].buffer_type = MYSQL_TYPE_LONG;
argv[argc].buffer = &uid;
argv[argc].is_unsigned = 1;

argv[++argc].buffer_type = MYSQL_TYPE_VARCHAR;
argv[argc].buffer = snonce;
argv[argc].buffer_length = nonlen;

argv[++argc].buffer_type = MYSQL_TYPE_VARCHAR;
argv[argc].buffer = sdigest;
argv[argc].buffer_length = diglen;

argv[++argc].buffer_type = MYSQL_TYPE_LONG;
argv[argc].buffer = &rc;

argv[++argc].buffer_type = MYSQL_TYPE_LONG;
argv[argc].buffer = flags;


/* Allocate DB context */
if ( !(1 & __db_getctx(&dbctx)) )
return $LOG(STS$K_ERROR, "No free DB context!");

#if PREPARED_SQL_STATEMENT
stmt = dbctx->stmt[QR_CHKAUTH2];
#else
if ( !(stmt = mysql_stmt_init(dbctx->mysql)) )
return $LOG(STS$K_ERROR, "stmt_init() : %s", mysql_error(dbctx->mysql));

if ( mysql_stmt_prepare(stmt, $ASCPTR(&stmts[QR_CHKAUTH2]), $ASCLEN(&stmts[QR_CHKAUTH2])) )
return $LOG(STS$K_ERROR, "stmt_prepare('%.*s') : %s", $ASC(&stmts[QR_CHKAUTH2]), mysql_error(dbctx->mysql));
#endif

/*
* Bind local variable to input argument of the SQL' routine
*/
if ( mysql_stmt_bind_param(stmt, argv) )
status = $LOG(STS$K_ERROR, "bind_param(dbctx:%08X, stmt:%08X) : %s", dbctx, stmt, mysql_stmt_error (stmt));

/*
* Execute preparsed SQL statement, check condition
*/
if ( mysql_stmt_execute(stmt) )
status = $LOG(STS$K_ERROR, "execute(dbctx:%08X, stmt:%08X) : %s", dbctx, stmt, mysql_stmt_error (stmt));
else if ( res = mysql_stmt_result_metadata(stmt) )
{
/*
* We got some result - performs a binding OUTput parameters
* to local variables and fetch it
*/
if ( mysql_stmt_bind_result(stmt, &argv[3]) )
status = $LOG(STS$K_ERROR, "bind_result(dbctx:%08X, stmt:%08X) : %s", dbctx, stmt, mysql_stmt_error (stmt));
else if ( mysql_stmt_fetch(stmt))
status = $LOG(STS$K_ERROR, "fetch(dbctx:%08X, stmt:%08X) : %s", dbctx, stmt, mysql_stmt_error (stmt));

assert(dbctx);
mysql_free_result(res);
assert(dbctx);

}
else status = $LOG(STS$K_ERROR, "No data is returned for UID=%d, execute(dbctx:%08X, stmt:%08X)", uid, dbctx, stmt);


#if PREPARED_SQL_STATEMENT
if ( mysql_stmt_reset(stmt) )
#else
if ( mysql_stmt_close(stmt) )
#endif
exit_flag = $LOG(STS$K_FATAL, "stmt_reset/close(dbctx:%08X, stmt:%08X) : %s", dbctx, stmt, mysql_stmt_error (stmt));

/* Release DB context */
if ( !(1 & __db_retctx(dbctx)) )
$LOG(STS$K_FATAL, "dbctx:%08X : Cannot release!", dbctx);

status = (1 & status) ? rc : status;

return status;
}

.... Some piece of output at execution time ...

06-12-2016 14:42:20.110 0xF7FD3780 %STMQRSVC-I: Client version: 6.1.6, thread safe = 1
06-12-2016 14:42:20.188 0xF7FD3780 %STMQRSVC-I: Server version: 0


net_serv.cc:196: void net_clear(NET*, my_bool): Assertion `!check_buffer || (vio_pending(net->vio) <= 1)' failed.


0 __GI_raise 56 0x7ffff6a2dc37
1 __GI_abort 89 0x7ffff6a31028
2 __assert_fail_base 92 0x7ffff6a26bf6
3 __GI___assert_fail 101 0x7ffff6a26ca2
4 net_clear net_serv.cc 196 0x4294d4
5 cli_advanced_command client.c 1157 0x41bbbc
6 reset_stmt_handle libmysql.c 4664 0x4176e0
7 mysql_stmt_reset libmysql.c 4769 0x417ab8
8 __db_chkauth2 0x40d627
9 __zz__ 0x40b8aa
10 main 0x4046c5



void net_clear(NET *net,
my_bool check_buffer __attribute__((unused)))
{
DBUG_ENTER("net_clear");

#if !defined(EMBEDDED_LIBRARY)
/* Ensure the socket buffer is empty, except for an EOF (at least 1). */
DBUG_ASSERT(!check_buffer || (vio_pending(net->vio) <= 1));
#endif

/* Ready for new command */
net->pkt_nr= net->compress_pkt_nr= 0;
net->write_pos= net->buff;

DBUG_VOID_RETURN;
}

...




So, why this assert is took place?!
Is there what I'm need to check additionaly ?


Thanks in advance!

Options: ReplyQuote


Subject
Views
Written By
Posted
mysql-connector-c-6.1.6-src/sql/net_serv.cc:196: void net_clear(NET*, my_bool): Assertion `!check_buffer || (vio_pending(net->vio) <= 1)' failed.
496
December 06, 2016 05:46AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.