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

_cache_io dictionary gets corrupted #15

Open
daveyboy103 opened this issue Nov 29, 2021 · 6 comments
Open

_cache_io dictionary gets corrupted #15

daveyboy103 opened this issue Nov 29, 2021 · 6 comments

Comments

@daveyboy103
Copy link
Collaborator

Sometimes the internal cache dictionaries for ObjectId and objects gets corrupted and the program tries to access a key that does not exist. Currently only fixable by restarting the server.

CLRObjectProxy.cs

@tr8dr
Copy link
Owner

tr8dr commented Nov 29, 2021

I am no longer maintaining this (aside from a JVM version). Is this from R or python? I think there are scenarios in R where it can release an object early, where it should not. If you don't mind objects piling up, you could change the code to cause the Release() function in CLRObjectProxy to do nothing.

I don't see any flaw in the C# logic. The object IDs will be unique (and increasing). The only way the object reference disappears is from the release call from R. Have seen this behavior in R myself (back when I was using R - have since switched to python).

Could alternatively create a list or queue of objects pending release, and delete the oldest ones (to avoid the R problem). The logic would be as follows: In the Release function do:

create a member variable called _pending_delete or something like that

_pending_delete.Add (obj);
if (_pending_delete.Length > somethreshold)
    <delete 1/2 of that threshold starting from oldest>
   <trim list or queue to remove the items no longer pending>

Somewhat more complex would be to:

  • queue objects for deletion when R "releases" the reference
  • if the object is touched again, the object is removed from the deletion queue
  • anything left in the queue is periodically deleted up to some threshold, so as to keep newer object in the pending state

@daveyboy103
Copy link
Collaborator Author

daveyboy103 commented Nov 29, 2021 via email

@tr8dr
Copy link
Owner

tr8dr commented Nov 29, 2021

Please do, feel free to submit fixes or enhancements - I will merge. I can just add you as permissioned for the project. I have improved the python side of this considerably, but against the JVM (alas have not had the time to release publicly).

@daveyboy103
Copy link
Collaborator Author

daveyboy103 commented Nov 29, 2021 via email

@tr8dr
Copy link
Owner

tr8dr commented Nov 29, 2021

Added you to the repo -- feel free to fix, add functionality, etc.

@daveyboy103
Copy link
Collaborator Author

daveyboy103 commented Nov 29, 2021 via email

daveyboy103 added a commit to daveyboy103/.Net-Bridge that referenced this issue Nov 29, 2021
Issue tr8dr#15

Changed to use ConcurrentDictionary to handle threading issues with dictionaries
Repository owner deleted a comment from renato71amorim Mar 4, 2024
Repository owner deleted a comment from jabreuint Mar 19, 2024
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

No branches or pull requests

2 participants