-
Notifications
You must be signed in to change notification settings - Fork 747
Add soft shutdown #958
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
Merged
Merged
Add soft shutdown #958
Changes from 1 commit
Commits
Show all changes
163 commits
Select commit
Hold shift + click to select a range
d1928dc
Drop LoadLibrary dependency
amos402 f000e08
Explain for getting _PyObject_NextNotImplemented
amos402 f882400
Update changelog and authors
amos402 b7715ee
Merge branch 'master' into drop-dlopen
filmor 41ac665
Merge remote-tracking branch 'remotes/upstream/master' into drop-dlopen
amos402 c6dae9e
Merge branch 'master' into drop-dlopen
amos402 4e19a4f
Add soft shutdown
amos402 657452e
* Fix refcnt error
amos402 91f64b9
Fixed leaking of tp_name
amos402 b07b844
* Reset type slots
amos402 7db724e
Clear ExtensionType
amos402 2a88be4
Del SlotsHolder from tp_dict when shutting down
amos402 2940973
Fix refcnt error of qualname
amos402 d108913
Since ClassBase not override tp_init for BaseException, repr(Exceptio…
amos402 cc9e7e5
* Use environment variable `PYTHONNET_SOFT_SHUTDOWN` to enable soft s…
amos402 1cb8e8c
Fixed deadlock on finalizer after shutdown
amos402 653a263
Merge branch 'master' into drop-dlopen
amos402 b3e889b
* Load PyModuleType without LibraryLoader
amos402 04d6dfb
Merge remote-tracking branch 'remotes/upstream/master' into drop-dlop…
amos402 5150e61
Prevent exception override
amos402 65e209e
Rollback symbol loading for __Internal
amos402 cad95da
Merge remote-tracking branch 'master' into soft-shutdown
amos402 0dee5da
Free GC handle for all subclass of ExtensionType
amos402 00a0b32
Specific exception types
amos402 77da6df
Record mp_length slot
amos402 2039e69
* Fix deadlock on domain unload
amos402 fe5050d
Fix refcnt error
amos402 593fb00
Reset a tuple for tp_bases
amos402 1ce83fc
Merge branch 'decref-types' into soft-shutdown
amos402 fba616a
Fix refcnt error
amos402 bdc0f72
* Use subtype slots instead JIT code
amos402 49d98e8
Clear tp_dict of ModuleObject
amos402 433d0f6
Manipulate SlotsHolder manually instead of Capsule mechanism
amos402 9b4864b
Merge branch 'master' into soft-shutdown
filmor 1b466df
* Drop NativeCodePage dependency
amos402 49130c4
Remove unused code
amos402 76ba510
Add tp_clear for constructorbinding
amos402 1ff21ac
tp_clear for EventBinding
amos402 0b01378
All base type corrected, remove unnecessary slot set
amos402 631bb43
Merge branch 'master' into soft-shutdown
amos402 bf3d9f8
Add basic `reload` shutdown mode
amos402 da97502
Data synchronization for PyScopeTest.TestThread
amos402 e8b3160
Disable `ShutdownMode.Reload` on `NETSTANDARD`
amos402 80d4fa0
* Serialize CLRObject
amos402 9874cd1
Add ShutdownMode.Default refer to normal mode if no EnvironmentVariab…
amos402 8da561b
Not generating the debug info for generated modules
amos402 9499c64
`TestDomainReload` use itself assembly instead of dynamic creation
amos402 431d644
Merge branch 'master' into drop-dlopen
amos402 2b84394
* Fix refcnt error
amos402 5ade069
Validate return value
amos402 8dabed7
Merge branch 'drop-dlopen' into soft-shutdown
amos402 f4bb77a
* API for getting the default shutdown mode
amos402 670bd74
In domain test, use soft mode if default mode is normal
amos402 3cb56f1
Avoid Domain tests influence other tests when the default is not Soft…
amos402 3c9a83c
Skip non-serializable objects
amos402 992c469
Merge branch 'soft-shutdown-reload' into soft-shutdown
amos402 924b217
Merge branch 'master' into soft-shutdown
amos402 df84e29
* Reset Exceptions to IntPtr.Zero
amos402 8b51621
Split RuntimeData into separate file
amos402 97c8c2a
Extract InitPyMembers method
amos402 39f47c8
* Classify runtime data
amos402 aa63f0b
* Stash for ImportHook
amos402 5b2f3d4
Merge branch 'master' into soft-shutdown
amos402 35cbe55
Apply Reference type usage
amos402 f23cae6
* Manipulate refcnt in Push/Pop objects
amos402 183f9d8
Load cache of ModuleObject after reload
amos402 9d57a82
Add temp tests reference by https://github.com/pythonnet/pythonnet/pu…
amos402 08fad26
* Fix refcnt error of MethodBinding
amos402 bcfdcc7
Test for class object on crossed domain
amos402 66ab719
Multi times for running cross dispose
amos402 1428af3
Merge branch 'master' into soft-shutdown
amos402 8e3c028
Apply Reference type usage
amos402 b387e9e
Merge branch 'master' into soft-shutdown
amos402 f85999e
Merge branch 'master' into soft-shutdown
amos402 cb65af3
Manually merge - remove redundant code
amos402 498fc8c
Manually merge - ManagedDataOffsets
amos402 cc2219e
Manually merge - capi prototype
amos402 8c8d66e
* Move fields of ManagedDataOffsets into nested type
amos402 4f00165
Avoid mess up the debug info of runtime module by emit IL code
amos402 39e20e3
Merge branch 'master' into soft-shutdown
amos402 da7c150
* Fix syntax error
amos402 02b1ada
Merge branch 'master' into soft-shutdown
amos402 a8840b2
Drop Python 2.7 on CI
amos402 dec7a74
Fix refcnt error
amos402 e877b33
Get platform information without import `platform`
amos402 6d738bf
Run callbacks registered by `atexit` at Shutdown on soft-shutdown mode
amos402 ff5edc3
Use named shutdown-mode value by environment value instead of simple …
amos402 5ac75ba
Remove dependency on importing `platform`. #891
amos402 65cb22e
Don't call exit functions on soft or reload shutdown
BadSingleton 73865d4
Adding to AUTHORS.MD
BadSingleton 1a75f51
Code review fixes
BadSingleton 9b6d140
Merge pull request #1 from Unity-Technologies/reload-shutdown-fix
amos402 d9d5562
Remove unused code
BadSingleton 9b62a61
Fixes some typos in TestDomainReload
BadSingleton 4f0420e
Adds missing assert
BadSingleton 4ab9f1c
Adds code comments to CrossDomainObject test
BadSingleton 32bcb3a
Adds documentation to TestDomainReload.TestClassReference
BadSingleton 0077ea8
Adds numbering to domain names in TestDomainReload
BadSingleton 38ea0b6
Use Console.WriteLine formatting overload
BadSingleton 06a656e
Inline called-once methods in TestDomainReload
BadSingleton 09f8281
Simplify PythonRunner.RunPython
BadSingleton 7ec9a6c
Release the GIL
BadSingleton 802a43a
BorrowReference instead of increasing the refcount
BadSingleton 0fdf969
Add IsTypeObject to Managed type
BadSingleton 3a8c72d
Rename PyObjectSerializeContext
BadSingleton b52bc01
Rename StashPush/Pop methods
BadSingleton bfbf2c3
Rename ClassManager.RemoveClasses
BadSingleton 883c4ce
Rename ClassManager.OnVisit
BadSingleton 7e0d56d
fixup! Inline called-once methods in TestDomainReload
BadSingleton 82034dc
Change refcount logic in ImportHook.Shutdown
BadSingleton 4ba50a7
Remove TODOS
BadSingleton 1ecdce8
Incref a valid pointer
BadSingleton b35f441
Use Py_CLEAR
BadSingleton ce8ee90
Fixes GIL grabbing during init and shutdown
BadSingleton 4c4bcb0
Add a parameter to specify the shutdown mode.
BadSingleton f575bd3
Add typeoffset.cs
BadSingleton d1799aa
Extract utility method in TestDomainReload
BadSingleton d2408b9
Add cleanup to ClassInfo
BadSingleton fd2b662
Update comment of `ClassManager.RemoveClasses`
amos402 2b7bcac
Fix typo errors
amos402 0af3504
Merge remote-tracking branch 'amos/soft-shutdown' into soft-shutdown-…
BadSingleton ba1df6e
fixup! Add cleanup to ClassInfo
BadSingleton 639ba1f
Add a new PyList constructor
BadSingleton 7e5ab52
Revert previous commit "Add cleaunp to class info"
BadSingleton 8075f48
Add corrections to the GIL acquiring/releasing
BadSingleton eb8cb8a
Factor out ExtensionType's Gc setup mechanic
BadSingleton 308f0f2
Revert "Release the GIL"
BadSingleton 1ae0bfe
fixup! Incref a valid pointer
BadSingleton 07aefe6
Revert "Add typeoffset.cs"
BadSingleton 5387b05
Merge remote-tracking branch 'remotes/upstream/master' into soft-shut…
amos402 b203674
Revert local project setting
amos402 19d1379
A better fix for releasing a re-acquiring the GIL
BadSingleton 25a4064
Add validation for downgrading the shutdown mode
BadSingleton 1272b89
Merge remote-tracking branch 'amos/soft-shutdown' into soft-shutdown-…
BadSingleton 8c133e3
Fixes for the merge
BadSingleton d9b21a5
Revert "Change refcount logic in ImportHook.Shutdown"
BadSingleton c8dee53
Document refcount increase
BadSingleton 598cb77
Disambiguate Initialization
BadSingleton 83e8dd5
Merge pull request #2 from Unity-Technologies/soft-shutdown-review-co…
amos402 6db3181
Revert local changes
amos402 e38a363
Remove unused code
amos402 b409a89
Check serializability of the whole type hierarchy
BadSingleton f5c24b0
Release the GIL on shutdown only if it can be released
BadSingleton 0d6c645
Call `WaitForPendingFinalizers` instead
BadSingleton fa89b48
Revert local changes
amos402 80a7644
Remove unused code
amos402 12c0206
Merge pull request #3 from Unity-Technologies/soft-shutdown-review-co…
amos402 6a3cfc8
Adds an unchecked version to get a BorrowedReference pointer
BadSingleton 98da1fa
Remove compile-time check on NETSTANDARD
BadSingleton d7d44e8
fixup! Remove compile-time check on NETSTANDARD
BadSingleton 6aa75c5
Factor out the clearing of clr_data
2343f89
Partially Revert "Adds an unchecked version to get a BorrowedReferenc…
cc6b8e4
More changes to use BorrowedReference and NewReference
BadSingleton d5fcfa4
fixup! More changes to use BorrowedReference and NewReference
BadSingleton fa47957
fixup! fixup! More changes to use BorrowedReference and NewReference
BadSingleton ff956e4
Remove unused method
BadSingleton c7b134c
Merge pull request #4 from Unity-Technologies/soft-shutdown-review-co…
amos402 97e61a5
Merge branch 'master' into soft-shutdown
amos402 0b9d2c1
Wait for full GC Complete
amos402 178cbc8
Release atexit manually
amos402 3a17f36
* Remove `fromPython`
amos402 3203457
Merge branch 'master' into soft-shutdown
amos402 8d00e4c
Merge branch 'master' into soft-shutdown
amos402 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
In domain test, use soft mode if default mode is normal
- Loading branch information
commit 670bd745be9f13dd2e8fff044b2691641e15dd37
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,7 +218,12 @@ public static void RunPython() | |
AppDomain.CurrentDomain.DomainUnload += OnDomainUnload; | ||
string name = AppDomain.CurrentDomain.FriendlyName; | ||
Console.WriteLine(string.Format("[{0} in .NET] In PythonRunner.RunPython", name)); | ||
PythonEngine.Initialize(); | ||
var mode = PythonEngine.DefaultShutdownMode; | ||
if (mode == ShutdownMode.Normal) | ||
{ | ||
mode = ShutdownMode.Soft; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is pretty obscure. |
||
PythonEngine.Initialize(mode: mode); | ||
using (Py.GIL()) | ||
{ | ||
try | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WriteLine
has an overload, that does formatting.