+ Start a Discussion
Justin WahlersJustin Wahlers 

Salesforce.com Internal Error and Batchable Classes


I am working on an apex batchable class that processes invoice records by creating new account and opportunity records based on the invoices. The class then deletes the processed invoices. The process is started by clicking a custom button (Process Invoices) added to the list view of invoices.

The problem that I am experiencing is that after pressing the process invoices button the class seems to process the first batch of records (batch size of 20), but never hits the second (or any other) instances of the batchable class' execute method.

The logs in the developer console show that operation "SerialBatchApexRangeChunkHandler" has a status of "Internal Salesforce.com Error". Unfortunately I cannot share code for security reasons, but if anyone has any experience with this error, and information regarding a fix I would appreciate the insight.
these sort of errors are tough, but you have some options.

1. Contact support and get the GACK details
If you email support the details of the internal server they can look it up on there back-end and find a stack trace. In many cases the stack trace may give a much clearer picture of what the error is and allow you to work around it.

2. Binary Search plus Trial and Error Workarounds
Use a binary search algorithm to identify the specific line of code leading to the error. In other words, comment out one half of the code, if the error still occurs, comment out the other. Keep reducing the amount commented out until you end up with a single line.
If you get to this point try and put yourself in the mind of the developers who built the underlying Salesforce functionality. What sort of things might be tricky to implement? What sort of things could lead to errors if not handled properly? Use trial and error to see if you can alter anything about the code to get the error to go away while still accomplishing your goal. Hack it to pieces, whatever it takes to work around the error and get back to working on new features.

3. Contact support and get their help
If your issues is consistently reproducible you can contact support and have them do the troubleshooting. This is not fun. Support is much better at handling user issues than platform bugs. It can take a very, very long time to even get support to understand the error, let alone believe it's something that's broken. Many a time I find a bug, work through endless emails, calls, and goto meetings only for them to tell me it's a known issue (that's not on the known issues list), and they won't fix it for fear that fixing the bug might break someone else's code (aka the "Bug as a Feature Response").
That said, if you stick with it, you'll get to the real support guys (Tier 3 and R&D) who are very skilled and can assist in fixing the issue. Provided of course, you don't mind waiting 3 months to a year for a patch to go out. And at the end of event, you'll get the satisfaction you made Salesforce just a little bit better.
hi am raj canu help me when batch run its shows but user not executive
View | Download | DeleteAGL AdminApiUnknownSerialBatchApexRangeChunkHandlerSuccess1211,12611/08 00:11:36
View | Download | DeleteAGL AdminApiUnknownBatch ApexSuccess1131,12611/08 00:11:36
View | Download | DeleteAGL AdminApiUnknownSerialBatchApexRangeChunkHandlerSuccess7854811/08 00:11:36
View | Download | DeleteAGL AdminApiUnknownSerialBatchApexRangeChunkHandlerSuccess4054911/08 00:11:36
View | Download | DeleteAGL AdminApiUnknownBatch ApexSuccess871,56711/08 00:11:35