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

crash in idf.py monitor after device disconnect (IDFGH-8153) #9649

Closed
3 tasks done
simpkins opened this issue Aug 26, 2022 · 2 comments
Closed
3 tasks done

crash in idf.py monitor after device disconnect (IDFGH-8153) #9649

simpkins opened this issue Aug 26, 2022 · 2 comments
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@simpkins
Copy link
Contributor

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

Relatively low priority, but I figured I would report this idf tool exception. I ran into a crash after leaving idf.py monitor running for a while after the device had been disconnected. This was on Linux, close to the head of master (v5.0-dev-4038-g9961061811)

Just from glancing at the error, it looks like the idf tool code can't handle very long lines. If the device is disconnected for long enough the idf monitor code will print enough . characters without a newline to crash the idf tool code that is reading from it.

device reports readiness to read but returned no data (device disconnected or multiple access on port?)
Traceback (most recent call last):
  File "/usr/lib/python3.8/asyncio/streams.py", line 540, in readline
    line = await self.readuntil(sep)
  File "/usr/lib/python3.8/asyncio/streams.py", line 618, in readuntil
    raise exceptions.LimitOverrunError(
asyncio.exceptions.LimitOverrunError: Separator is not found, and chunk exceed the limit

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/src/esp-idf/tools/idf.py", line 808, in <module>
    main()
  File "/usr/local/src/esp-idf/tools/idf.py", line 743, in main
    cli(sys.argv[1:], prog_name=PROG, complete_var=SHELL_COMPLETE_VAR)
  File "/home/simpkins/.espressif/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/simpkins/.espressif/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/simpkins/.espressif/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/click/core.py", line 1691, in invoke
    return _process_result(rv)
  File "/home/simpkins/.espressif/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/click/core.py", line 1628, in _process_result
    value = ctx.invoke(self._result_callback, value, **ctx.params)
  File "/home/simpkins/.espressif/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/src/esp-idf/tools/idf.py", line 638, in execute_tasks
    task(ctx, global_args, task.action_args)
  File "/usr/local/src/esp-idf/tools/idf.py", line 216, in __call__
    self.callback(self.name, context, global_args, **action_args)
  File "/usr/local/src/esp-idf/tools/idf_py_actions/serial_ext.py", line 159, in monitor
    RunTool('idf_monitor', monitor_args, args.project_dir, build_dir=args.build_dir, hints=hints)()
  File "/usr/local/src/esp-idf/tools/idf_py_actions/tools.py", line 146, in __call__
    process, stderr_output_file, stdout_output_file = asyncio.run(self.run_command(self.args, env_copy))
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/local/src/esp-idf/tools/idf_py_actions/tools.py", line 180, in run_command
    await asyncio.gather(
  File "/usr/local/src/esp-idf/tools/idf_py_actions/tools.py", line 210, in read_and_write_stream
    out = await input_stream.readline()
  File "/usr/lib/python3.8/asyncio/streams.py", line 549, in readline
    raise ValueError(e.args[0])
ValueError: Separator is not found, and chunk exceed the limit
@espressif-bot espressif-bot added the Status: Opened Issue is new label Aug 26, 2022
@github-actions github-actions bot changed the title crash in idf.py monitor after device disconnect crash in idf.py monitor after device disconnect (IDFGH-8153) Aug 26, 2022
@dobairoland
Copy link
Collaborator

Thanks, you are right @simpkins. We need nicer error messages than this.

@simpkins
Copy link
Contributor Author

Actually, the fix for #9432 looks like it might have fixed this already by adding interactive=True in serial_ext.py. That change causes it to avoid the readline() call, at least for the monitor tool. The commit where I saw this error did not yet include that fix.

@espressif-bot espressif-bot added Status: In Progress Work is in progress Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new Status: In Progress Work is in progress Resolution: NA Issue resolution is unavailable labels Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

3 participants