1

I was running a batch and by mistake, I set LIMIT in the query as 1 instead of 1000 now it is flooding with debug logs and I not responding. I have deleted all pending scheduled jobs. SO my question is how should I kill running chain and how should I recover dev console?

2

Clearing your Scheduled Jobs won't fix the problem; Batchable appears in Apex Jobs. You will have to abort the job from that page (or use the AsyncApexJob table to cancel the job), or wait until it completes. The Developer Console, being JavaScript based, doesn't handle a large number of logs very well (~1000, or more than about 2 logs per second). Your best choice to recover the console is to close that window, then abort the job, then reopen it. You work is usually saved, so there's little risk in closing the Developer Console. Your browser may insist on "killing" the page because it is slow or unresponsive; if you get that message, go ahead and do so. You'll find it challenging to use Salesforce properly until you do, as the Developer Console and the tab/page that opened it usually share the same "thread" (meaning the Developer Console will make Salesforce unresponsive, too!).

  • I more question where can I go to abort AsyncApexJob ? – Ishan May 24 '17 at 13:59
  • @Ishan You can use basically any IDE (including the Developer Console) to kill the job. The code you need looks like this: List<AsyncApexJob> jobs = [SELECT Id, Status FROM AsyncApexJob WHERE Status NOT IN ('Completed', 'Failed') FOR UPDATE]; for (AsyncApexJob job : jobs) { System.abortJob(job.Id); } The Force.com IDE, Developer Workbench, MavensMate, and more can all execute this code. – sfdcfox May 24 '17 at 14:12
  • I am hardly able to open anything in dev console – Ishan May 24 '17 at 14:15
  • @Ishan Yeah, you won't be able to. Try workbench.developerforce.com, log in, and run the code from utilities > Apex Execute. – sfdcfox May 24 '17 at 14:16
  • It is showing this error EXCEPTION: System.QueryException: Record Currently Unavailable: The record you are attempting to edit, or one of its related records, is currently being modified by another user. Please try again. STACKTRACE: AnonymousBlock: line 1, column 1 LINE: 1 COLUMN: 1 – Ishan May 24 '17 at 14:20
2

Another alternative is to not use the Developer Console at all but instead go for an IDE like Illuminated Cloud, MavensMate or for specific tasks use the Workbench. I've switched over to an IDE quite some time now and I must say I've never looked back. No more Developer Console for me :-)

  • Too bad IC isn't free. Looks like a great product, but I given how many tools are free, they should at least be competitive... – sfdcfox May 24 '17 at 14:20
  • Correct it's a one-time payment; but it has boosted my productivity enough to be well worth the cost. There are other alternatives as well, and even the Workbench could do the trick. Main thing is to consider alternatives to the Dev Console to do the job, freeing us of the burden of a constant stream of debug logs. – Willem Mulder May 24 '17 at 14:38
  • @sfdcfox - Yea, small one time cost. The offline debugger is worth its weight in gold. Would Happily pay more as it has boosted my ability to be productive and debug that much. IMHO it is the best IDE/Plugin out there. Its well worth the $65.00 one time cost. It has saved me much more than that vs using other tools. But I digress. – Eric May 25 '17 at 1:44
0

To free up the Developer Console you could stop the flood of Log entries coming in. It is likely responding to the Streaming API event every time a new log is published and running a query to find all the latest logs.

To stop the logs coming in you can delete or alter the TraceFlag for the current user. One option would be to do this via Setup - See Customize Trace Flags and Debug Levels in Setup. You could also do this via the APIs directly, but the Setup UI would be the simplest. enter image description here

Once the flood of logs is stopped you can then look at killing the run away job.

  • When deleting the trace flag the dev console will almost alway automatically add it back. At least in the test I just did.... – Eric May 25 '17 at 1:50
  • I know it adds a new one when the Developer Console is opened. Maybe altering the TraceFlag.ExpirationDate into the past would be more productive. – Daniel Ballinger May 25 '17 at 2:29
  • it added new ones when the flag was deleted with it open as well but my testing could be flawed as well – Eric May 25 '17 at 4:49

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.