1

When viewing a debug log where the logging level was set to:

APEX_CODE,FINEST;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO

I am seeing a large gap in time (~7 seconds) between my DML operation (followed by a heap allocate) and the entry into a manage package trigger. Does anyone know what is happening during these ~7 seconds? My understanding is that the managed package code is not running until the ENTERING_MANAGED_PKG statement, so does that mean that Salesforce is simply spending ~7 seconds waiting for the database?

Here is the log output from the operation in question:

12:07:22.840 (721566107)|DML_BEGIN|[542]|Op:Insert|Account|Rows:1
12:07:22.841 (721590807)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:12
12:07:29.159 (7064591521)|ENTERING_MANAGED_PKG|MyPkg
  • This is wildly speculative, but my best guess is that it's needing to recompile the managed apex for some reason. – ca_peterson Nov 13 '15 at 4:19
  • I don't think this is the case because Salesforce made an update to the Apex runtime a while ago where Apex code now directly compiles to Java bytecode. developer.salesforce.com/blogs/developer-relations/2011/12/… – dsharrison Nov 13 '15 at 18:19
  • oh it absoluteley still does, but there are mechanisms for compiling and invalidating the resulting bytecode. Whenever there are material changes to the schema in an org for example it throws it away and re-compiles on the fly for the next request. Generally this happens at the start of the request, but I don't know the real meat of their implementation. – ca_peterson Nov 13 '15 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.