Skip to content

Pickle dump is not flushed before exit#167

Open
Johan511 wants to merge 3 commits intoseL4:masterfrom
Johan511:hhn/flush-on-dump
Open

Pickle dump is not flushed before exit#167
Johan511 wants to merge 3 commits intoseL4:masterfrom
Johan511:hhn/flush-on-dump

Conversation

@Johan511
Copy link
Copy Markdown

@Johan511 Johan511 commented Mar 21, 2026

Hi, I have been playing around with seL4 recently and had faced the following error

Traceback (most recent call last):
  File "camkes-project/projects/capdl/python-capdl-tool/../cdl_utils/capdl_linker.py", line 153, in <module>
    sys.exit(main())
             ~~~~^^
  File "camkes-project/projects/capdl/python-capdl-tool/../cdl_utils/capdl_linker.py", line 127, in main
    allocator_state = pickle.load(args.manifest_in)
EOFError: Ran out of input

The pickle file generated seems to be empty, possibly because it is not flushed before sys.exit is called.

.close() implicitly flushes the file and also closes it.

@Johan511 Johan511 force-pushed the hhn/flush-on-dump branch 2 times, most recently from bbe295b to 3f00553 Compare March 21, 2026 21:29
Signed-off-by: HHN <harihara.sn@gmail.com>
@Johan511 Johan511 force-pushed the hhn/flush-on-dump branch from 3f00553 to a7c3749 Compare March 21, 2026 21:40
lsf37
lsf37 previously approved these changes Mar 31, 2026
Copy link
Copy Markdown
Member

@lsf37 lsf37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I can at least not see that this change would hurt.

@lsf37
Copy link
Copy Markdown
Member

lsf37 commented Mar 31, 2026

On second thought, have you seen this fix your problem? Because the only thing that runs afterwards is sys.exit which should close the file and do the same thing.

@lsf37 lsf37 dismissed their stale review March 31, 2026 01:26

The change should not be necessary

@Johan511
Copy link
Copy Markdown
Author

Yes, this did fix my problem.

I have explicitly verified that commenting out the line leads to the error, whereas closing the file explicitly causes no such errors.

I am not very well-versed with the internals of python so can not comment on why sys.exit does not implicitly flush the file.

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

Successfully merging this pull request may close these issues.

2 participants