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

[doc] Missing Documentation for Error Codes #344

Closed
mgravell opened this issue Nov 28, 2022 · 6 comments
Closed

[doc] Missing Documentation for Error Codes #344

mgravell opened this issue Nov 28, 2022 · 6 comments
Labels
documentation Improvements or Additions to Documentation

Comments

@mgravell
Copy link

mgravell commented Nov 28, 2022

Context

If we refer to https://github.com/demikernel/demikernel/blob/dev/man/demi_pop.md, for example, we see:

  • EBADF - The I/O queue descriptor qd does not refer to a valid I/O queue.
  • EAGAIN - Demikernel failed to create an asynchronous co-routine to handle the demi_pop() operation.

As an external caller: what are those values?

Proposed Solution

When specific error codes should be anticipated, document the corresponding literal integer values, since that is what an external consumer needs to know. Obviously we can interpret any non-zero number as a general error, but: the ability to understand more-specific errors would be useful.

It would be sufficient to link to a shared list of error codes, rather than updating every page individually.

@mgravell mgravell added the enhancement Enhancement Request on an Existing Feature label Nov 28, 2022
@ppenna ppenna changed the title [enhancement] docs: please document error codes [doc] Missing Documentation for Error Codes Nov 28, 2022
@ppenna ppenna self-assigned this Nov 28, 2022
@ppenna
Copy link
Contributor

ppenna commented Nov 28, 2022

@mgravell the literal values for these error codes are platform dependent. They match whatever value the underlying OS uses in #include <errno.h>. I understand that you are suggesting that we ship our own error codes. Is that the case?

@mgravell
Copy link
Author

mgravell commented Nov 28, 2022

@ppenna I suspect "yes"; external API consumers need to bind to something fixed - when calling between languages, runtimes, etc, with different build times and infrastructure, it is otherwise going to be impossible (or at least, exceptionally hard) to know how to interpret any given integer. We can't even rely on "non-zero? just explode", since the wait API now returns a specific number to mean "I timed out". Right now I've hard-coded that via manual discovery of what number I got, but that doesn't work in the general sense, if those numbers aren't fixed.

External API consumers are going to need to know what error code that timeout is, without knowing your build infrastructure. Likewise other error messages, although they're probably less critical if they all mean "something bad". As a corollary: maybe timeout shouldn't be an error? Maybe timeout should return 0 but signal the timeout via another mechanism. For example, it could return -1 in the offset parameter. Or with #341 in mind, return ~offset for whatever offset it was looking at (which would still allow timeout to be identified as a negative, while also allowing the offset to be retained between calls)

@mgravell
Copy link
Author

To put that in specific terms: consider a .NET client - I would expect to ship that as a nupkg binary (with the unmanaged lib for various platforms contained internally). That binary does not have access to errno.h - the C# is typically built separately, at a separate time, probably on a CI server. I'm pretty sure this will be commonly the case among most non-C/Rust consumers.

@ppenna
Copy link
Contributor

ppenna commented Nov 28, 2022

@iyzhang , @BrianZill and @anandbonde please take a look on this.

@ppenna ppenna removed their assignment Nov 29, 2022
@BrianZill
Copy link
Contributor

I agree, we should have our own error codes, independent of platform.

@ppenna ppenna added this to the Demikernel v1.1 milestone Feb 27, 2023
@ppenna ppenna unassigned ppenna and iyzhang Apr 5, 2023
@ppenna ppenna added documentation Improvements or Additions to Documentation and removed enhancement Enhancement Request on an Existing Feature labels May 31, 2023
@iyzhang
Copy link
Contributor

iyzhang commented Jul 7, 2023

Hi Marc, thanks for filing this. We are tabling this for now because we do not have any customers that require this and we do not have the wo(man) power to revise our error codes at this time. We do have the infrastructure in place to change them in the future however because we do have our own Rust fail data structure that we could move to a custom error code system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or Additions to Documentation
Projects
None yet
Development

No branches or pull requests

5 participants