function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
feelsfdcfeelsfdc 

Batch Apex messages in Debug log

Hi,

 

I am here with a question on Batch Apex. In the debug log, Batch Apex showing 'SQLException thrown but connection was canceled' and taking much time to complete the batch job but, completes without any errors. My question is why is it showing this message?  Moreover I am left with no clues by reading this message.

 

I am running this job in Full sandbox  which contains thousands of records. when I ran the same batch job in Development sandbox I don't find any messages in debug log and finishes so fast.

 

Any comments on this ..

 

Thanks.

bob_buzzardbob_buzzard

When you check the apex jobs log, do you see any failures for the batch job?  Can you tell us a bit more about what you are trying to do in the batch job execute?

feelsfdcfeelsfdc

Hi Bob,

 

I don't see any failures in the debug log regarding batch. But, it's taking so much time and everytime when I click on "refresh"(F5) it is showing me that error and din't see a row under debuglog tells batch 'success'.  but after 20 - 25  min i will get a row Batch success message. During this 25 min time window refresh gives SQL exception Message.

 

Coming to my Logic in execute() method, I am not doing any complex coding. Just taking a lead  from staing table and cheking against some conditions and updating records in the table.  This also includes setting "Qualify" check field. If the record is qualified  then that will be inserted into the Lead table. (you may think I can directly create a lead directly.. , but this is purely our business requirement..)

 

Please suggest me . How can I get rid of this one..

 

Thanks,

bob_buzzardbob_buzzard

Have you tried adding some debug logging to the batch job and turning on debug logs for the user you execute it as?  That may help you to find out where the time is being spent.  25 minutes does sound like quite a lot of time, but I guess it may be reasonable depending on what else your org and the salesforce servers are doing.

feelsfdcfeelsfdc

yes I turned Debug logs on and got some debugs with 'SQLException thrown but connection was canceled ' message. It is stopping at the code where I was trying to get aggregare result.

 

the aggregate Soql is like this:  It's not showing Error though.  Any reason why it's taking much time?

 

select Household_Number__c,
min(Membership_Number__pc) minmembershipno
from Account
where Household_Number__c in :memberNumberList
group
by Household_Number__c