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

Potential death time parsing bug #9

Open
cacharle opened this issue Jan 12, 2021 · 3 comments
Open

Potential death time parsing bug #9

cacharle opened this issue Jan 12, 2021 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@cacharle
Copy link
Contributor

I had this error once with philo_one:

DEATH TIMING

[2 MS] [3 MS] [2 MS] [2 MS] Traceback (most recent call last):
  File "./socrates.py", line 281, in <module>
    exit(socrates(args.path, args.philo))
  File "./socrates.py", line 242, in socrates
    test_program(f"{bin_path}/philo_one/philo_one")
  File "./socrates.py", line 157, in test_program
    if run_starvation_measures(binary) is False:
  File "./socrates.py", line 131, in run_starvation_measures
    measure_starvation_timing(binary, results)
  File "./socrates.py", line 108, in measure_starvation_timing
    death_time = int(last_line[:separator_index].strip("\0"))
ValueError: invalid literal for int() with base 10: 'dyld:'

When I run the test on my own I have the following output:

❯ ./philo_one 3 310 200 100 | cat -e
0 2 has taken fork$
0 2 has taken fork$
0 2 is eating$
2 3 has taken fork$
200 2 is sleeping$
200 3 has taken fork$
200 3 is eating$
200 1 has taken fork$
300 2 is thinking$
311 2 died$

I never had this error before.

@nesvoboda
Copy link
Owner

Thanks for the report! I Your program clearly works, as you've shown in the example. It has also worked the first 4 times in the error output. But it looks to me as if it probably ended with an error of some kind, hence the dyld: part.

What we can possibly do from our side to mitigate that is to check if the program has returned gracefully before parsing the output, what do you think?

@nesvoboda nesvoboda added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Jan 12, 2021
@cacharle
Copy link
Contributor Author

I think the non parsable output should be printed (or at least the few last lines) and have a clear message that it couldn't be parsed.
Then continue the other tests.

@nesvoboda
Copy link
Owner

That makes a lot of sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants