Raised This Month: $12 Target: $400
 3% 

Solved [SQLx]Thread worked was unable to start


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lexzor
Veteran Member
Join Date: Nov 2020
Old 05-06-2021 , 10:14   [SQLx]Thread worked was unable to start
Reply With Quote #1

hello
how can i get rid of this error ?

Code:
L 05/06/2021 - 17:08:35: [MySQL] Thread worker was unable to start.
L 05/06/2021 - 17:08:35: [AMXX] Displaying debug trace (plugin "panel.amxx", version "1.0")
L 05/06/2021 - 17:08:35: [AMXX] Run time error 10: native error (native "SQL_ThreadQuery")
L 05/06/2021 - 17:08:35: [AMXX]    [0] panel.sma::InsertDataIntoSql (line 612)
it appears after map is changing and players are joining on server.

i'm using a query for every player to save some data.

Last edited by lexzor; 05-22-2021 at 12:05.
lexzor is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 05-06-2021 , 11:57   Re: [SQLx]Thread worked was unable to start
Reply With Quote #2

How are you suppose to get any help if you're not posting any source code?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
lexzor
Veteran Member
Join Date: Nov 2020
Old 05-06-2021 , 12:12   Re: [SQLx]Thread worked was unable to start
Reply With Quote #3

PHP Code:
public client_putinserver(id)
{
    if (
is_user_bot(id) || is_user_hltv(id) || !is_user_connected(id))
        return 

    
g_iPlayedTime[id][Seconds] = 0
    g_iPlayedTime
[id][Minutes] = 0
    g_iPlayedTime
[id][Hours] = 0

    get_users_info
(id)

    
check_player_sql_info(id)
}

public 
check_player_sql_info(id)
{
    new 
szQuery[512], szData[1]
    
szData[0] = id

    get_users_info
(id)

    
formatex(szQuerycharsmax(szQuery), "SELECT * FROM `%s` WHERE `name` = '%s'"g_szTables[5], g_iPlayersInfo[id][Name])
    
SQL_ThreadQuery(g_SqlTuple"GetPlayerData"szQueryszData1)
}

public 
GetPlayerData(FailStateHandle:QueryszError[], ErrorCodeszData[], iSize)
{
    if(
FailState || ErrorCode)
    {
        
server_print(" ")
        
server_print("[Advanced Panel] SQL ERROR: %s"szError)
        
server_print(" ")
    }

    new 
id szData[0]
    new 
szQuery[512]

    
mysql_escape_string(g_iPlayersInfo[id][Name], charsmax(g_iPlayersInfo[][Name]))

    
get_users_info(id)
    
format_lastvisit_string(id)

    if(
SQL_NumResults(Query) < 1)
    {
        
copy(g_iPlayersInfo[id][LastVisit], charsmax(g_iPlayersInfo[][LastVisit]), g_iPlayersInfo[id][FirstSeen])

        
formatex(szQuerycharsmax(szQuery), "INSERT INTO `%s` ( `name`,`ipaddress`,`steamid`,`frags`,`deaths`,`headshots`,`score`,`firstseen`,`lastvisit`,`total_played_time` ) VALUES ( '%s','%s','%s','0','0','0','0','%s','%s','00:00:00' )"
        
g_szTables[5], g_iPlayersInfo[id][Name], g_iPlayersInfo[id][Address], g_iPlayersInfo[id][AuthID], g_iPlayersInfo[id][FirstSeen], g_iPlayersInfo[id][LastVisit])

        
SQL_ThreadQuery(g_SqlTuple"FreeHandle"szQuery)
    }
    else 
    {
        
formatex(szQuerycharsmax(szQuery), "UPDATE `%s` SET `lastvisit` = '%s'"g_szTables[5], g_iPlayersInfo[id][LastVisit])
        
SQL_ThreadQuery(g_SqlTuple"FreeHandle"szQuery)
    }
}

public 
FreeHandle(FailStateHandle:QueryszError[], ErrorCodeszData[], iSize)
{
    if(
FailState || ErrorCode)
    {
        
server_print(" ")
        
server_print("[Advanced Panel] SQL ERROR: %s"szError)
        
server_print(" ")
    }
    
    
SQL_FreeHandle(Query);

i read a topic where bugsy say this is not a code problem is a sqlx socket problem or smth like this and i was thinking that i don t need to post code and there is a simple solution like create a set_task for every id.

anyway, if you have any advices to improve the code tell me how

Last edited by lexzor; 05-06-2021 at 12:32.
lexzor is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-20-2021 , 23:04   Re: [SQLx]Thread worked was unable to start
Reply With Quote #4

I'm not sure if it's a module issue as I've never had this issue with SQLx so it may be a query problem. Have you outputted your queries in a log file to confirm they are formatted correctly?

It's hard for anyone to troubleshoot with only parts of the code. I am not going to spend the time to fill in the blanks to get it to compile and test.
__________________
Bugsy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 05-21-2021 , 07:55   Re: [SQLx]Thread worked was unable to start
Reply With Quote #5

Why you didnt show this function panel.sma::InsertDataIntoSql
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Rohanlogs
Senior Member
Join Date: Nov 2015
Old 05-21-2021 , 14:00   Re: [SQLx]Thread worked was unable to start
Reply With Quote #6

You're asking how to get rid of an error in code, without showing the code.
Eh..? If you don't want to, you don't have to post the whole script, however we need to see the line where the error occurs and all other functions/variables which are connected/calling that function which causes the error.
Like bugsy said nobody is going to take their time to try and fill in the blanks to somehow reproduce your error..

You thinking you don't need to post the code because its just ''sqlx problem'' which someone said 10 years ago is absurd. I'm detecting a little bit of XY problem here.

We can't give you a magical solution to these kind of errors without seeing the code.
__________________
Rohanlogs is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 05-22-2021 , 12:05   Re: [SQLx]Thread worked was unable to start
Reply With Quote #7

I posted the wrong code. Sorry about this.

Problem solved: There must be a delay after map change for query and add is_user_connected check.
PHP Code:
switch(id)
    {
        case 
1..9set_task(0.1"insert_new_player"id PutInTask)
        case 
10..21set_task(0.2"insert_new_player"id PutInTask)
        case 
22..32set_task(0.3"insert_new_player"id PutInTask)
    } 
lexzor is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode