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

sam.nim(199, 10) n.mapper.tokens[n.pos].kind == JSMN_OBJECT assertionDefect #67

Closed
Retrodynen opened this issue Dec 2, 2021 · 20 comments

Comments

@Retrodynen
Copy link
Contributor

Bot randomly starts to crash - change in bot API?

I'm forced to rerun the bot with clean=true to get rid of the message queue, it then works for several more days until the same thing happens. 


Error: unhandled exception: /home/zack/.nimble/pkgs/sam-0.1.17/sam.nim(199, 10) `n.mapper.tokens[n.pos].kind == JSMN_OBJECT`  
Async traceback: 
 /home/zack/.nimble/pkgs/cligen-1.5.19/cligen.nim(788)                       banner 
 /home/zack/.nimble/pkgs/cligen-1.5.19/cligen.nim(720)                       multiSubs 
 /home/zack/.nimble/pkgs/cligen-1.5.19/cligen.nim(802)                       multi 
 /home/zack/.nimble/pkgs/cligen-1.5.19/cligen.nim(720)                       dispatchstart 
 /med/sync/MiscDocs/mbot/banner.nim(103)                                     tgmain 
 /home/zack/.nimble/pkgs/telebot-1.0.11/telebot/private/api.nim(1170)        poll 
 /home/zack/.choosenim/toolchains/nim-1.6.0/lib/pure/asyncdispatch.nim(1961) waitFor 
 /home/zack/.choosenim/toolchains/nim-1.6.0/lib/pure/asyncdispatch.nim(1653) poll 
 /home/zack/.choosenim/toolchains/nim-1.6.0/lib/pure/asyncdispatch.nim(1394) runOnce 
 /home/zack/.choosenim/toolchains/nim-1.6.0/lib/pure/asyncdispatch.nim(234)  processPendingCallbacks 
 /home/zack/.choosenim/toolchains/nim-1.6.0/lib/pure/asyncmacro.nim(28)      loopNimAsyncContinue 
 /home/zack/.nimble/pkgs/telebot-1.0.11/telebot/private/api.nim(1164)        loopIter 
 /home/zack/.nimble/pkgs/telebot-1.0.11/telebot/private/utils.nim(97)        unmarshal 
 /home/zack/.nimble/pkgs/telebot-1.0.11/telebot/private/utils.nim(176)       toOption 
 /home/zack/.nimble/pkgs/telebot-1.0.11/telebot/private/utils.nim(99)        unmarshal 
 /home/zack/.nimble/pkgs/telebot-1.0.11/telebot/private/utils.nim(107)       unmarshal 
 /home/zack/.nimble/pkgs/sam-0.1.17/sam.nim(199)                             [] 
 /home/zack/.choosenim/toolchains/nim-1.6.0/lib/system/assertions.nim(38)    failedAssertImpl 
 /home/zack/.choosenim/toolchains/nim-1.6.0/lib/system/assertions.nim(28)    raiseAssert 
 /home/zack/.choosenim/toolchains/nim-1.6.0/lib/system/fatal.nim(53)         sysFatal 
Exception message: /home/zack/.nimble/pkgs/sam-0.1.17/sam.nim(199, 10) `n.mapper.tokens[n.pos].kind == JSMN_OBJECT`  
[AssertionDefect]
@ba0f3
Copy link
Owner

ba0f3 commented Dec 3, 2021

Can you print r.body before this line to see what server gives? https://github.com/ba0f3/telebot.nim/blob/master/src/telebot/private/utils.nim#L199

@Retrodynen
Copy link
Contributor Author

Retrodynen commented Dec 3, 2021 via email

@ba0f3
Copy link
Owner

ba0f3 commented Dec 3, 2021

Thank you!

@Retrodynen
Copy link
Contributor Author

"message":{"message_id":4930974,"from":{"id":484446095,"is_bot":false,"is_deleted":false,"first_name":"Nathan","last_name":"Smith","username":"Ligmanuts"},"chat":{"id":-1001133642811,"title":"/bant/ International Ra 
ndom - also Charlottes blog/ModP playground/Molochs Slayers appreciation group","username":"bantchan","type":"supergroup"},"date":1638440871,"text":"Badge #696969"}}]} 
/home/zack/.nimble/pkgs/cligen-1.5.19/cligen.nim(788Error: unhandled exception: /home/zack/.nimble/pkgs/sam-0.1.17/sam.nim(239, 10) `node.mapper.tokens[node.pos].kind == JSMN_STRING`  
Async traceback: 
 /home/zack/.nimble/pkgs/cligen-1.5.19/cligen.nim(788)                       banner

@Retrodynen
Copy link
Contributor Author

Weird, it seems it's spanning multiple lines?


{"update_id":30499219, 
"message":{"message_id":4930974,"from":{"id":484446095,"is_bot":false,"is_deleted":false,"first_name":"Nathan","last_name":"Smith","username":"Ligmanuts"},"chat":{"id":-1001133642811,"title":"/bant/ International Ra 
ndom - also Charlottes blog/ModP playground/Molochs Slayers appreciation group","username":"bantchan","type":"supergroup"},"date":1638440871,"text":"Badge #696969"}}]} 
/home/zack/.nimble/pkgs/cligen-1.5.19/cligen.nim(788Error: unhandled exception: /home/zack/.nimble/pkgs/sam-0.1.17/sam.nim(239, 10) `node.mapper.tokens[node.pos].kind == JSMN_STRING` 

@ba0f3
Copy link
Owner

ba0f3 commented Dec 3, 2021

looks weird, Is there newline in chat title?

@Retrodynen
Copy link
Contributor Author

There isn't

@ba0f3
Copy link
Owner

ba0f3 commented Dec 3, 2021

the json you give me is invalid

@Retrodynen
Copy link
Contributor Author

is this an issue with telegram's servers then or?

@ba0f3
Copy link
Owner

ba0f3 commented Dec 7, 2021

I dont think it came from telegram server. maybe you was behind a proxy or somthing?

@Retrodynen
Copy link
Contributor Author

Retrodynen commented Dec 7, 2021 via email

@ba0f3
Copy link
Owner

ba0f3 commented Dec 7, 2021

yes sure, reach me at @quhng on telegram

@ba0f3
Copy link
Owner

ba0f3 commented Dec 11, 2021

I think the result was too large, its a sam's problem.

Try to reduce number of updates per request by set limit parameter in loop or getUpdates proc

@Retrodynen
Copy link
Contributor Author

I did bot.poll(timeout=300, limit=10) instead of bot.poll(timeout=300), the same error occurs. :(

ba0f3 added a commit that referenced this issue Jan 1, 2022
@ba0f3
Copy link
Owner

ba0f3 commented Jan 1, 2022

@Retrodynen please check it again

@Retrodynen
Copy link
Contributor Author

Will do!

@Retrodynen
Copy link
Contributor Author

/home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(788) banner
/home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(764) multiSubs
/home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(802) multi
/home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(764) dispatchstart
/home/tgbot/mbot/banner.nim(112) tgmain
/home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/api.nim(1185) poll
/home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncdispatch.nim(1961) waitFor
/home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncdispatch.nim(1653) poll
/home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncdispatch.nim(1394) runOnce
/home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncdispatch.nim(234) processPendingCallbacks
/home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncmacro.nim(28) loopNimAsyncContinue
/home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/api.nim(1179) loopIter
/home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/utils.nim(96) unmarshal
/home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/utils.nim(195) toOption
/home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/utils.nim(96) unmarshal
/home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/utils.nim(209) toOption
/home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/utils.nim(180) unref
/home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/utils.nim(106) unmarshal
/home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/json.nim(517) []
/home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/collections/tables.nim(246) []
/home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/collections/tables.nim(234) raiseKeyError
[[reraised from:
/home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(788) banner
/home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(764) multiSubs
/home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(802) multi
/home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(764) dispatchstart
/home/tgbot/mbot/banner.nim(112) tgmain
/home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/api.nim(1185) poll
/home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncdispatch.nim(1963) waitFor
/home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncfutures.nim(389) read
]]
Error: unhandled exception: key not found: type
Async traceback:
  /home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(788)                           banner
  /home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(764)                           multiSubs
  /home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(802)                           multi
  /home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(764)                           dispatchstart
  /home/tgbot/mbot/banner.nim(112)                                                 tgmain
  /home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/api.nim(1185)        poll
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncdispatch.nim(1961)     waitFor
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncdispatch.nim(1653)     poll
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncdispatch.nim(1394)     runOnce
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncdispatch.nim(234)      processPendingCallbacks
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncmacro.nim(28)          loopNimAsyncContinue
  /home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/api.nim(1179)        loopIter
  /home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/utils.nim(96)        unmarshal
  /home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/utils.nim(195)       toOption
  /home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/utils.nim(96)        unmarshal
  /home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/utils.nim(209)       toOption
  /home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/utils.nim(180)       unref
  /home/tgbot/.nimble/pkgs/telebot-2022.01.01/telebot/private/utils.nim(106)       unmarshal
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/json.nim(517)               []
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/collections/tables.nim(246) []
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/collections/tables.nim(234) raiseKeyError
Exception message: key not found: type

@Retrodynen
Copy link
Contributor Author

Ok I moved to 2022.01.02 and get:

[[reraised from:
/home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(788) banner
/home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(764) multiSubs
/home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(802) multi
/home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(764) dispatchstart
/home/tgbot/mbot/banner.nim(112) tgmain
/home/tgbot/.nimble/pkgs/telebot-2022.01.02/telebot/private/api.nim(1185) poll
/home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncdispatch.nim(1963) waitFor
/home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncfutures.nim(389) read
]]
Error: unhandled exception: key not found: correct_option_id
Async traceback:
  /home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(788)                           banner
  /home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(764)                           multiSubs
  /home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(802)                           multi
  /home/tgbot/.nimble/pkgs/cligen-1.5.19/cligen.nim(764)                           dispatchstart
  /home/tgbot/mbot/banner.nim(112)                                                 tgmain
  /home/tgbot/.nimble/pkgs/telebot-2022.01.02/telebot/private/api.nim(1185)        poll
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncdispatch.nim(1961)     waitFor
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncdispatch.nim(1653)     poll
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncdispatch.nim(1394)     runOnce
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncdispatch.nim(234)      processPendingCallbacks
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/asyncmacro.nim(28)          loopNimAsyncContinue
  /home/tgbot/.nimble/pkgs/telebot-2022.01.02/telebot/private/api.nim(1179)        loopIter
  /home/tgbot/.nimble/pkgs/telebot-2022.01.02/telebot/private/utils.nim(98)        unmarshal
  /home/tgbot/.nimble/pkgs/telebot-2022.01.02/telebot/private/utils.nim(189)       toOption
  /home/tgbot/.nimble/pkgs/telebot-2022.01.02/telebot/private/utils.nim(98)        unmarshal
  /home/tgbot/.nimble/pkgs/telebot-2022.01.02/telebot/private/utils.nim(189)       toOption
  /home/tgbot/.nimble/pkgs/telebot-2022.01.02/telebot/private/utils.nim(100)       unmarshal
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/json.nim(517)               []
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/collections/tables.nim(246) []
  /home/tgbot/.choosenim/toolchains/nim-1.6.2/lib/pure/collections/tables.nim(234) raiseKeyError
Exception message: key not found: correct_option_id
 [KeyError]

@Retrodynen
Copy link
Contributor Author

Hi, it seems commit ecb8dc1c895fe67e0739ffba027336dc0a8e750a made my bot unresponsive to any command, The bot runs and I can see it receive commands in the debug output but it doesn't seem to react to the command at all. If I switch back to dbd11a3684cd8d0db4724ca6494365c5f1ec093b it works fine. Any ideas?

ba0f3 added a commit that referenced this issue Jan 7, 2022
…elebotInternalUse` instead of `type` dirty hack. BREAKING CHANGE! ref #67
@ba0f3
Copy link
Owner

ba0f3 commented Feb 2, 2022

Close this issue cuz sam is not being used anymore

@ba0f3 ba0f3 closed this as completed Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants