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

Replace the impl of Syscall.rename and remove Mono.Posix.NETStandard #1641

Merged
merged 1 commit into from
Jan 14, 2021

Conversation

davidmrdavid
Copy link
Contributor

@davidmrdavid davidmrdavid commented Jan 13, 2021

Mono.Posix.NETStandard was included since Durable Functions v2.3.1, which increased the size of the deployment package by nearly three times.

This is a contribution by @shibayan :)

And I have verified that this implementation still raises the correct inotify signal, so our telemetry pipeline should continue to work with it

Issue describing the changes in this PR

#1597

resolves #1597

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation PR is ready to merge and referenced in pending_docs.md
  • My changes should not be added to the release notes for the next release
  • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • I have added all required tests (Unit tests, E2E tests)

@davidmrdavid
Copy link
Contributor Author

As for adding unit tests for this, we don't have a linux enviroment in our durable-extension pipeline, do we? If we did, I could add an inotify test

@ConnorMcMahon
Copy link
Contributor

We could add a step to the smoke test validation step for release to make sure that high volume traffic on Linux doesn't miss data? Not sure how easy that would be and how much value it would have, but without substantial work, we definitely can't unit test this right now (we use windows workers on our CI).

Copy link
Contributor

@ConnorMcMahon ConnorMcMahon left a comment

Choose a reason for hiding this comment

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

I am pretty sure this looks good, I just want to fully understand what is going on in the Windows (or even running locally on Mac) case, where "libc" is not available.

#endif

}

#if !FUNCTIONS_V1
[DllImport("libc", SetLastError = true)]
Copy link
Contributor

Choose a reason for hiding this comment

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

How does [DllImport] work if the library is not available (for instance, on Windows)?

Does this dynamically try to import this functionality when rename is actually called? In that case, this likely isn't an issue since this logger should never actually be used on Windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding is that DllImport will not actually seek to invoke any system-level libraries until rename is called, so this shouldn't be an issue.

From this SO answer: https://stackoverflow.com/questions/39144458/what-happens-if-i-have-dllimport-c-net-for-an-api-not-supported-by-the-opera

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, we should decide on whether in the degenerate case this logger class is used on a non-Linux platform if we fail fast with an exception, or we should wrap the call to rename() in a try-catch.

@cgillum, what are your thoughts in this scenario? I normally lean towards just letting the exception propagate, but since this is logging code I'm never quite sure of proper error handling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I +1 failing fast if we're somehow using the logger in windows

Copy link
Member

Choose a reason for hiding this comment

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

Don't we have code that always ensures we're only running this logger in Linux? I'm fine with letting it fail on Windows, though I recommend we log the failure before rethrowing any exception so that someone debugging will have a bit more context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the suggestion is to: catch, then log, then re-throw? Got it :)

@davidmrdavid davidmrdavid changed the base branch from dev to dajusto/fix-rename January 14, 2021 21:29
@davidmrdavid
Copy link
Contributor Author

Merging this into dajusto/fix-rename where I'll make sure this passes the linter and that the new suggestions are incorporated before merging to dev. Thank you for your contribution!

@davidmrdavid davidmrdavid merged commit ee0e2aa into Azure:dajusto/fix-rename Jan 14, 2021
davidmrdavid added a commit that referenced this pull request Jan 15, 2021
…(follow-up to #1641) (#1643)

Co-authored-by: Tatsuro Shibamura <me@shibayan.jp>
@shibayan shibayan deleted the remove-mono-posix branch January 18, 2021 09:38
davidmrdavid added a commit that referenced this pull request Jan 28, 2021
…(follow-up to #1641) (#1643)

Co-authored-by: Tatsuro Shibamura <me@shibayan.jp>
davidmrdavid added a commit that referenced this pull request Jan 28, 2021
…(follow-up to #1641) (#1643)

Co-authored-by: Tatsuro Shibamura <me@shibayan.jp>
davidmrdavid added a commit that referenced this pull request Jan 28, 2021
…(follow-up to #1641) (#1643)

Co-authored-by: Tatsuro Shibamura <me@shibayan.jp>
davidmrdavid added a commit that referenced this pull request Jan 28, 2021
* Replace the impl of Syscall.rename and remove Mono.Posix.NETStandard (follow-up to #1641) (#1643)

Co-authored-by: Tatsuro Shibamura <me@shibayan.jp>

* Adding Missing Fields to Linux Logger: ProviderName, TaskName, ActivityId, RelatedActivityId, StampName, etc (#1515)

* Linux Logger now supports the legacy regex logging path (#1522)

"It's done, it's finally done" - Frodo

Co-authored-by: David Justo <dajusto@microsoft.com>
Co-authored-by: Chris Gillum <cgillum@microsoft.com>

* Replace the impl of Syscall.rename and remove Mono.Posix.NETStandard (follow-up to #1641) (#1643)

Co-authored-by: Tatsuro Shibamura <me@shibayan.jp>

* Shift tracing inside conditional check

* Added Tracing options, project compiles

* Disable verbosity check in V1

* Remove unecessary xml file, remove release notes, update release version, update azurestorage

* Update azurestorage refs in test csprojs

* downgrade back to azurestorage 1.7.7

Co-authored-by: Tatsuro Shibamura <me@shibayan.jp>
Co-authored-by: David Justo <dajusto@microsoft.com>
Co-authored-by: Chris Gillum <cgillum@microsoft.com>
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.

Mono.Posix.NETStandard is making the deployment package size excessively large
4 participants