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

[snips-nlu][1.1.0 (0.61.1)] - 'ai.snips.nlu' panicked at 'no entry found for key' when multiple slots with the same name in an intent #94

Closed
cpoisson opened this Issue Feb 28, 2019 · 9 comments

Comments

Projects
None yet
4 participants
@cpoisson
Copy link
Collaborator

cpoisson commented Feb 28, 2019

snips-nlu seems to crash on some configuration with the following logs

thread 'ai.snips.nlu' panicked at 'no entry found for key', src/libcore/option.rs:1008:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
[10:41:49.221570] ERROR:snips_nlu                      : Fail to wait end of pipeline
 -> caused by: Fail wait end pipeline
 -> caused by: receiving on a closed channel

Version: Snips Flow - 1.1.0 (0.61.1)

Platform: Seen on Linux, MacOS

How to reproduce:
Use the following assistant :
https://www.dropbox.com/s/karp9yaryh2waft/assistant_proj_61q7KMpkmVqY.zip?dl=0

Stack Trace

[10:22:30.372117] DEBUG:hermes_mqtt                    : Received a message on MQTT topic '"hermes/nlu/query"', payload: {"input":"what is one plus one","asrTokens":[{"value":"what","confidence":1.0,"rangeStart":0,"rangeEnd":4,"time":{"start":0.0,"end":0.48}},{"value":"is","confidence":1.0,"rangeStart":5,"rangeEnd":7,"time":{"start":0.48,"end":0.59999996}},{"value":"one","confidence":1.0,"rangeStart":8,"rangeEnd":11,"time":{"start":0.59999996,"end":0.78}},{"value":"plus","confidence":0.9116909,"rangeStart":12,"rangeEnd":16,"time":{"start":0.78,"end":0.96413517}},{"value":"one","confidence":1.0,"rangeStart":17,"rangeEnd":20,"time":{"start":0.96413517,"end":2.1}}],"intentFilter":null,"id":"65c483f1-420e-48c0-ae27-629661115180","sessionId":"15907d39-e2aa-4126-9a01-f27053311741"}
thread 'ai.snips.nlu' panicked at 'no entry found for key', src/libcore/option.rs:1008:5
stack backtrace:
   0:        0x10b5863d3 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h08f8400730f7e177
   1:        0x10b589e98 - std::panicking::default_hook::{{closure}}::hd93a62a6385425eb
   2:        0x10b588d9c - std::panicking::rust_panic_with_hook::h1571a8276c1c75ce
   3:        0x10b58886d - std::panicking::continue_panic_fmt::h002fe449ab16211f
   4:        0x10b58b4c8 - rust_begin_unwind
   5:        0x10b59c3e9 - core::panicking::panic_fmt::ha6cac24b425a9352
   6:        0x10b58f908 - core::option::expect_failed::h95537a7ed32a9c9e
   7:        0x10a60a3ec - <core::iter::Map<I, F> as core::iter::iterator::Iterator>::next::h576b89094984d7d1
   8:        0x10a607ab8 - snips_nlu_lib::intent_parser::deterministic_intent_parser::DeterministicIntentParser::get_matching_result::h3277ac3078ef8230
   9:        0x10a605f71 - snips_nlu_lib::intent_parser::deterministic_intent_parser::DeterministicIntentParser::parse_top_intents::h429982378d1ae8b2
  10:        0x10a6038f2 - <snips_nlu_lib::intent_parser::deterministic_intent_parser::DeterministicIntentParser as snips_nlu_lib::intent_parser::IntentParser>::parse::h347882e42fde3930
  11:        0x10a5622ac - snips_nlu_hermes::hermes_run::{{closure}}::{{closure}}::h115c1aa6df6ae829
  12:        0x10a571cb2 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1d07b8591b96dfd0
  13:        0x10a58ff2f - <F as alloc::boxed::FnBox<A>>::call_box::h4182a324db0187cd
  14:        0x10b579ba7 - std::sys::unix::thread::Thread::new::thread_start::h6ed3af13534ba90c
  15:     0x7fff6d3b6304 - _pthread_body
  16:     0x7fff6d3b926e - _pthread_start
[10:22:30.574440] ERROR:snips_nlu                      : Fail to wait end of pipeline
 -> caused by: Fail wait end pipeline
 -> caused by: receiving on a closed channel

@cpoisson cpoisson self-assigned this Feb 28, 2019

@zaphodus

This comment has been minimized.

Copy link

zaphodus commented Feb 28, 2019

Maybe this helps to reproduce:

Platform: Linux (4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l GNU/Linux) - Raspbian
Version: 0.61.1
Assistant: https://console.snips.ai/assistants/proj_AdlrP7A3zXDA
Intent: https://console.snips.ai/intent-editor/intent_DeNV6axZWAa

_snips@jarvis:~$ RUST_BACKTRACE=1 snips-nlu -v
[20:56:41.322472] DEBUG:snips_common_cli::cli: conf lookup: snips-nlu.assistant -> Ok(None)
[20:56:41.322893] DEBUG:snips_common_cli::cli: conf lookup: snips-common.assistant -> Ok(None)
[20:56:41.323112] DEBUG:snips_common_cli::cli: conf lookup: snips-nlu.model -> Ok(None)
[20:56:41.323226] DEBUG:snips_common_cli::cli: conf lookup: snips-common.model -> Ok(None)
[20:56:41.323338] DEBUG:snips_common_cli::cli: conf lookup: snips-nlu.user_dir -> Ok(None)
[20:56:41.323445] DEBUG:snips_common_cli::cli: conf lookup: snips-common.user_dir -> Ok(None)
[20:56:41.323553] DEBUG:snips_common_cli::cli: conf lookup: snips-nlu.bus -> Ok(None)
[20:56:41.323657] DEBUG:snips_common_cli::cli: conf lookup: snips-common.bus -> Ok(None)
[20:56:41.323768] DEBUG:snips_common_cli::cli: conf lookup: snips-nlu.mqtt -> Ok(None)
[20:56:41.323872] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt -> Ok(None)
[20:56:41.324093] DEBUG:snips_common_cli::cli: conf lookup: snips-nlu.mqtt_username -> Ok(None)
[20:56:41.324194] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt_username -> Ok(None)
[20:56:41.324286] DEBUG:snips_common_cli::cli: conf lookup: snips-nlu.mqtt_password -> Ok(None)
[20:56:41.324374] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt_password -> Ok(None)
[20:56:41.324466] DEBUG:snips_common_cli::cli: conf lookup: snips-nlu.mqtt_tls_hostname -> Ok(None)
[20:56:41.324557] DEBUG:snips_common_cli::cli: conf lookup: snips-common.mqtt_tls_hostname -> Ok(None)
[20:56:41.332884] DEBUG:snips_nlu_hermes     : nlu thread started
[20:56:41.333035] DEBUG:snips_injection_lib::injectable: computing injections dirname from reference dir "/usr/share/snips/assistant"
[20:56:41.333160] INFO :snips_nlu_hermes               : loading nlu engine "/usr/share/snips/assistant/nlu_engine"
[20:56:42.719589] INFO :snips_nlu_hermes               : model loaded in 1386 ms
[20:56:42.719928] DEBUG:snips_nlu_hermes               : idle
thread 'nlu' panicked at 'no entry found for key', src/libcore/option.rs:1008:5
stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
[20:56:47.183820] ERROR:snips_nlu                      : Fail to wait end of pipeline
 -> caused by: Fail wait end pipeline
 -> caused by: receiving on a closed channel

[20:56:47.183906] ERROR:rumqtt::client                 : snips-nlu|14474-jarvis-1 Disconnected: (Error(SyncMpsc(Disconnected), State { next_error: None, backtrace: Some(stack backtrace:
   0: <no info> (0x11077db)
   1: <no info> (0x108d69f)
   2: <no info> (0x1079fb3)
   3: <no info> (0x107dd5f)
   4: <no info> (0x107d9f7)
   5: <no info> (0x125aff3)) })
Feb 28 21:02:34 jarvis snips-hotword[14232]: INFO:snips_hotword_hermes        : Hotword detected: site_id:living_room model:default (332ms ago)
Feb 28 21:02:34 jarvis snips-dialogue[14237]: INFO:snips_dialogue_lib::coordinator::coordinator: Site [living_room]: reset site -> turn off ASR and turn off Hotword
Feb 28 21:02:34 jarvis snips-dialogue[14237]: INFO:snips_dialogue_lib::coordinator::coordinator: Session [fcf0d35d-148c-4338-8268-3cda7ec75f47]: The session has been created because the site "living_room" is free
Feb 28 21:02:34 jarvis snips-asr[14249]: INFO:snips_asr_hermes          : Listening
Feb 28 21:02:34 jarvis snips-hotword[14232]: INFO:snips_hotword_lib::audio    : Audio thread for site living_room stopped.
Feb 28 21:02:34 jarvis snips-asr[14249]: INFO:snips_asr_lib::asr        : T0       entered AsrRunner::run
Feb 28 21:02:34 jarvis snips-asr[14249]: INFO:snips_asr_lib::asr        : T0+0.000 capture started
Feb 28 21:02:37 jarvis snips-asr[14249]: INFO:snips_asr_lib::asr        : T0+3.216 endpoint detected (rule:2) frame:195 samples:49920 signal_time:3.12 rtf:0.670
Feb 28 21:02:37 jarvis snips-asr[14249]: INFO:snips_asr_lib::asr        : Source thread stop on push: "Disconnected(..)"
Feb 28 21:02:37 jarvis snips-asr[14249]: INFO:snips_asr_lib::asr        : T0+3.219 capture ended
Feb 28 21:02:37 jarvis snips-asr[14249]: INFO:snips_asr_lib::asr        : T0+3.248 decoder finalized
Feb 28 21:02:37 jarvis snips-asr[14249]: INFO:snips_asr_lib::asr        : T0+3.283 lookup and post-processing done
Feb 28 21:02:37 jarvis snips-asr[14249]: INFO:snips_asr_lib::asr        : decoded: [Recognition { decoded_string: "what time is it", likelihood: 0.9492711, tokens: Some([Token { value: "what", confidence: 0.9824558, time: (0.0, 1.4110526), range: 0..4 }, Token { value: "time", confidence: 0.94565064, time: (1.4110526, 1.6813116), range: 5..9 }, Token { value: "is", confidence: 0.89618564, time: (1.6813116, 1.7994031), range: 10..12 }, Token { value: "it", confidence: 0.9752574, time: (1.7994031, 2.9399998), range: 13..15 }]) }]
Feb 28 21:02:37 jarvis snips-asr[14249]: INFO:snips_asr_hermes          : Cleanup
Feb 28 21:02:37 jarvis snips-asr[14249]: INFO:snips_asr_hermes          : Preparing decoder
Feb 28 21:02:37 jarvis snips-nlu[14530]: thread 'nlu' panicked at 'no entry found for key', src/libcore/option.rs:1008:5
Feb 28 21:02:37 jarvis snips-nlu[14530]: note: Run with `RUST_BACKTRACE=1` for a backtrace.
Feb 28 21:02:37 jarvis snips-nlu[14530]: ERROR:snips_nlu       : Fail to wait end of pipeline
Feb 28 21:02:37 jarvis snips-nlu[14530]:  -> caused by: Fail wait end pipeline
Feb 28 21:02:37 jarvis snips-nlu[14530]:  -> caused by: receiving on a closed channel
Feb 28 21:02:37 jarvis systemd[1]: snips-nlu.service: Main process exited, code=exited, status=1/FAILURE
Feb 28 21:02:37 jarvis systemd[1]: snips-nlu.service: Unit entered failed state.
Feb 28 21:02:37 jarvis systemd[1]: snips-nlu.service: Failed with result 'exit-code'.
Feb 28 21:02:38 jarvis snips-asr[14249]: INFO:snips_asr_hermes          : Idle
Feb 28 21:02:42 jarvis systemd[1]: snips-nlu.service: Service hold-off time over, scheduling restart.
Feb 28 21:02:42 jarvis systemd[1]: Stopped Snips NLU.
Feb 28 21:02:42 jarvis systemd[1]: Started Snips NLU.
Feb 28 21:02:43 jarvis snips-nlu[14604]: INFO:snips_nlu_hermes: loading nlu engine "/usr/share/snips/assistant/nlu_engine"
Feb 28 21:02:44 jarvis snips-nlu[14604]: INFO:snips_nlu_hermes: model loaded in 1400 ms
@oziee

This comment has been minimized.

Copy link

oziee commented Feb 28, 2019

macOS Snips 0.61.1

https://www.dropbox.com/s/karp9yaryh2waft/assistant_proj_61q7KMpkmVqY.zip?dl=0

[16:20:54.504918] INFO :snips_nlu_hermes               : model loaded in 676 ms
[16:20:54.504944] DEBUG:snips_nlu_hermes               : idle
[16:21:00.482989] DEBUG:rumqtt::connection             : snips-nlu|3072-server.local-1 Received message on hermes/nlu/query
[16:21:00.483028] DEBUG:hermes_mqtt                    : Received a message on MQTT topic '"hermes/nlu/query"', payload: {"input":"what is one plus one","asrTokens":[{"value":"what","confidence":1.0,"rangeStart":0,"rangeEnd":4,"time":{"start":0.0,"end":2.01}},{"value":"is","confidence":1.0,"rangeStart":5,"rangeEnd":7,"time":{"start":2.01,"end":2.37}},{"value":"one","confidence":1.0,"rangeStart":8,"rangeEnd":11,"time":{"start":2.37,"end":2.73}},{"value":"plus","confidence":1.0,"rangeStart":12,"rangeEnd":16,"time":{"start":2.73,"end":3.09}},{"value":"one","confidence":1.0,"rangeStart":17,"rangeEnd":20,"time":{"start":3.09,"end":4.2}}],"intentFilter":null,"id":"5cc7d564-1059-44ca-8e3f-efc6a6957ac2","sessionId":"9a5567cd-9727-4c8e-99c3-d547a9cdc918"}
thread 'ai.snips.nlu' panicked at 'no entry found for key', src/libcore/option.rs:1008:5
stack backtrace:
   0:        0x1016573d3 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h08f8400730f7e177
   1:        0x10165ae98 - std::panicking::default_hook::{{closure}}::hd93a62a6385425eb
   2:        0x101659d9c - std::panicking::rust_panic_with_hook::h1571a8276c1c75ce
   3:        0x10165986d - std::panicking::continue_panic_fmt::h002fe449ab16211f
   4:        0x10165c4c8 - rust_begin_unwind
   5:        0x10166d3e9 - core::panicking::panic_fmt::ha6cac24b425a9352
   6:        0x101660908 - core::option::expect_failed::h95537a7ed32a9c9e
   7:        0x1006db3ec - <core::iter::Map<I, F> as core::iter::iterator::Iterator>::next::h576b89094984d7d1
   8:        0x1006d8ab8 - snips_nlu_lib::intent_parser::deterministic_intent_parser::DeterministicIntentParser::get_matching_result::h3277ac3078ef8230
   9:        0x1006d6f71 - snips_nlu_lib::intent_parser::deterministic_intent_parser::DeterministicIntentParser::parse_top_intents::h429982378d1ae8b2
  10:        0x1006d48f2 - <snips_nlu_lib::intent_parser::deterministic_intent_parser::DeterministicIntentParser as snips_nlu_lib::intent_parser::IntentParser>::parse::h347882e42fde3930
  11:        0x1006332ac - snips_nlu_hermes::hermes_run::{{closure}}::{{closure}}::h115c1aa6df6ae829
  12:        0x100642cb2 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1d07b8591b96dfd0
  13:        0x100660f2f - <F as alloc::boxed::FnBox<A>>::call_box::h4182a324db0187cd
  14:        0x10164aba7 - std::sys::unix::thread::Thread::new::thread_start::h6ed3af13534ba90c
  15:     0x7fff58ece304 - _pthread_body
  16:     0x7fff58ed126e - _pthread_start
[16:21:00.607244] ERROR:snips_nlu                      : Fail to wait end of pipeline
 -> caused by: Fail wait end pipeline
 -> caused by: receiving on a closed channel

@cpoisson

This comment has been minimized.

Copy link
Collaborator Author

cpoisson commented Mar 1, 2019

Thanks guys!

We could reproduce the issue with your assistant @oziee

Thanks for your help!

@cpoisson

This comment has been minimized.

Copy link
Collaborator Author

cpoisson commented Mar 1, 2019

We found the issue.

Here's more information about it.

When does it happen

This bug affects only assistants with intents containing twice (or more) the same slot name in an utterance.

e.g.
“what is one plus three” where “one” and “three” are labelled with the same slot name (for instance “number”).

Where is the issue

The issue lies within the deterministic intent parser. It was already existing before but the recent changes make it more likely to happen.

Workarounds

There is two possible workaround to this issue:

  • Modify your assistant to not use the same slot name within the same intent.

  • Hack your current assistant by removing the patterns of the affected intents in the file: assistant/nlu_engine/deterministic_intent_parser/intent_parser.json.

e.g.

"ozie:mathsQuestion": [
    "^\\s*(?P<group9>%SNIPSNUMBER%)\\s*(?P<group6>%MATHSFUNCTION%)\\s*(?P<group9_2>%SNIPSNUMBER%)\\s*$",
      "^\\s*what\\s*s\\s*(?P<group6>%MATHSFUNCTION%)\\s*of\\s*(?P<group9>%SNIPSNUMBER%)\\s*$",
          ...
          ]

become

"ozie:mathsQuestion": [
          ]

Fix Delivery

@cpoisson cpoisson changed the title [Snips NLU] 0.61.1 - 'ai.snips.nlu' panicked at 'no entry found for key' [Snips NLU] 0.61.1 - 'ai.snips.nlu' panicked at 'no entry found for key' when multiple slots with the same name in an intent Mar 1, 2019

@oziee

This comment has been minimized.

Copy link

oziee commented Mar 1, 2019

  • Modify your assistant to not use the same slot name within the same intent.

not an option as you would have noticed with my assistant :)

did the option 2 Hack... NLU not crashing now :)

@cpoisson

This comment has been minimized.

Copy link
Collaborator Author

cpoisson commented Mar 1, 2019

Glad it works!

not an option as you would have noticed with my assistant :)

I could not fork your app on the console to check the content.
Out of curiosity, why is it not possible to differentiate the name of your numbers using the same snips/number builtin type?

The implementation could be something like this:
For commutative operations (+, -, *)

  • 'Hey Snips, What's the result of "number_1" plus "number_2"?'

For division

  • 'Hey Snips, What's the result of "number_dividend" divided by "number_divisor"?'

For exponentiation

  • 'Hey Snips, What's the result of "number_base" exponent "number_exponent"?''
@oziee

This comment has been minimized.

Copy link

oziee commented Mar 1, 2019

because maths calculations are not always simple two number tasks

"what is 2 plus 9 subtract 4 times 81"
"tally up 7 to the power of 6 minus 1 million divided by 55 take 99"

so the user can ask as many items as they want and my code just uses BOMDAS to do complex maths operations
screen shot 2019-03-02 at 8 22 42 am

@zaphodus

This comment has been minimized.

Copy link

zaphodus commented Mar 2, 2019

Thank you! Editing intent_parse.json solved the problem.

@cpoisson cpoisson changed the title [Snips NLU] 0.61.1 - 'ai.snips.nlu' panicked at 'no entry found for key' when multiple slots with the same name in an intent [Snips NLU][1.1.0 (0.61.1)] - 'ai.snips.nlu' panicked at 'no entry found for key' when multiple slots with the same name in an intent Mar 4, 2019

@cpoisson cpoisson added this to the Release 1.1.3 milestone Mar 4, 2019

@cpoisson cpoisson changed the title [Snips NLU][1.1.0 (0.61.1)] - 'ai.snips.nlu' panicked at 'no entry found for key' when multiple slots with the same name in an intent [snips-nlu][1.1.0 (0.61.1)] - 'ai.snips.nlu' panicked at 'no entry found for key' when multiple slots with the same name in an intent Mar 4, 2019

@cpoisson

This comment has been minimized.

Copy link
Collaborator Author

cpoisson commented Mar 5, 2019

Fixed in version 1.1.2 (0.62.0)

Tested using Calculations application made by Ozie.

@cpoisson cpoisson closed this Mar 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.