-
Notifications
You must be signed in to change notification settings - Fork 33
[1.1.5] Fix OC scheduling of compiles #1447
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
Conversation
…ting dropped because the queue is full. Also call free_code when code is no longer used instead of waiting for LIB.
| write_message(nextup->code_id(), nextup->msg, nextup->fds_to_pass); | ||
| std::vector<wrapped_fd> fds_to_pass; | ||
| fds_to_pass.emplace_back(memfd_for_bytearray(nextup->code)); | ||
| write_message(nextup->code_id(), nextup->msg, fds_to_pass); |
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.
Not related to this change, but I feel write_message should take a std::span<wrapped_fd instead of a std::vector, so we could pass one without emplacing to a vector with a heap alloc.
| _queued_compiles.emplace_front(std::move(msg), std::move(code)); | ||
| else | ||
| _queued_compiles.emplace_back(std::move(msg), std::move(fds_to_pass)); | ||
| _queued_compiles.emplace_back(std::move(msg), std::move(code)); |
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.
Shall we fix the typo in the type queued_compilies_t?
| #ifdef EOSIO_EOS_VM_OC_RUNTIME_ENABLED | ||
| if(eosvmoc) for(auto it = first_it; it != last_it; it++) | ||
| eosvmoc->cc.free_code(it->code_hash, it->vm_version); | ||
| #endif |
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.
The changes aren't what we discussed. afaict the way we discussed would be 1) for this code to remain here, and 2) for the added lines above (where this here was moved to) would exist but would check that the code was set in the same block prior to doing the removal. That first_block_used is currently inaccessible from there but it would be trivial to plumb it through starting from here
spring/libraries/chain/eosio_contract.cpp
Lines 156 to 163 in 504fa82
| if( existing_code ) { | |
| const code_object& old_code_entry = db.get<code_object, by_code_hash>(boost::make_tuple(account.code_hash, account.vm_type, account.vm_version)); | |
| EOS_ASSERT( old_code_entry.code_hash != code_hash, set_exact_code, | |
| "contract is already running this version of code" ); | |
| old_size = (int64_t)old_code_entry.code.size() * config::setcode_ram_bytes_multiplier; | |
| if( old_code_entry.code_ref_count == 1 ) { | |
| db.remove(old_code_entry); | |
| context.control.code_block_num_last_used(account.code_hash, account.vm_type, account.vm_version, context.control.head().block_num() + 1); |
Also, I realize now the discussion might have been ambiguous w.r.t. to us making this change strictly for OC or more universally. I believe the problem we are trying to solve applies for any runtime not just OC so I suspect we should be doing this universally. Maybe this aspect needs to be discussed idk
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.
Let's discuss in standup. @arhag
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.
…g to modify free code on last block used to only free if same block
…herwise wait for LIB
Use an unbounded queue for
_result_queueto avoid results getting dropped because the queue is full.Also call
free_codewhen code is no longer used instead of waiting for LIB to reduce memory growth.Resolves #1441