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
cpu used is greater than 90% #117
Comments
Hi @meoliver, thanks for your report. Can you record an instrument session with the Time Profiler so we can debug which code is actually causing the load? |
I have to reason, but some question, need you to explain. When the request error ,call back, Call Class PiwikTracker method eventsFromStore: completionBlock: (line 1490 ), completionBlock parameter hasMore may be yes。 I want to know Class PiwikTracker line1461 -- line 1490 thanks |
@brototyp If you are paying attention to my question? |
Hi @meoliver, thanks for digging into the issue. As far as I understand you: When there is an issue transmitting an event to the server and not all events can be transmitted with one call to the server, the SDK will try to transmit the same event(s) over and over. If the error is always the same it will always repeat to transmit the same event over and over again. As far as I can see this should be prevented by the shouldContinue value in the failure completion block. The 'PiwikNSURLSessionDispatcher.m' has a '-shouldAbortdispatchForNetworkError:' method that should return yes for a NSURLErrorCannotFindHost error. This matches with what you found out. I am not sure why in your case this leads to excessive CPU load. Did you were able to record an Instruments session with the Time Profiler? |
@brototyp thanks。 when '-shouldAbortdispatchForNetworkError:' return yes,and call 'eventsFromStore: completionBlock: ' When the core data, save the data after the article has more than 20. numberOfEvents is 20; completionBlock(entityIDs, events, eventEntities.count == fetchRequest.fetchLimit ? YES : NO); // this ‘eventEntities.count == fetchRequest.fetchLimit‘ is yes。 } NSURLErrorCannotFindHost error ,There has been。 method 'sendEvent ' void (^failureBlock)(BOOL shouldContinue) = ^ (BOOL shouldContinue) {
******* this code pay attention to****** // method ’sendEventDidFinishHasMorePending:' hasMore is yes, call ’sendEvent‘,but NSURLErrorCannotFindHost error,He'll cycle call。 // ’sendEvent‘----’eventsFromStore:completionBlock:‘----failureBlock() ----- ’sendEvent‘ ******* this code pay attention to******
|
@meoliver I am still not sure what you are meaning. Let me try to elaborate:
Is this correct? Did you were able to record an Instruments session with the Time Profiler? Please attach a Time Profiler session. |
@brototyp thanks。
The @"http://tracking.googlerror.com/piwik/" is NSURLErrorCannotFindHost the failure-block (PiwikTracker:1033) add nslog(),For example: if (shouldContinue) { and Click on the for more than 21 times。look the log |
Hi @meoliver, thanks for the recording. I was able to reproduce the issue and I guess I know what the issue is: |
@brototyp thanks
|
@brototyp Hi, line 1490 The third parameter is yes,and shouldAbortdispatchForNetworkError: return yes 。This will call cycles。 thanks |
I think that is expected behavior. The sdk continues trying to transmit events if there is a timeout. We expect it to just be a temporary issue. Do you know what your timeout duration is? Here the timeout duration decides the "looping". So if the timeout is 1s the sdk will loop once per second. Which is an issue in the architecture. Better would be: If an event can't be transmitted in a transmission run we should not retry this event in this run. That is a bigger issue and requires quite some refactoring so we only fetch events we haven't already fetched. I am not sure what your question there is. The |
@brototyp Thank you very much care about my question. Or,I modify the native code? |
Please try to change it locally in your code. We are currently rewriting the whole sdk, fully written in swift. We are making sure this bug doesn't exist in the new sdk. |
@meoliver - do you have a patch for this problem? We face it as well and we cannot wait for swift version. Could you please send it to me (tomas.kapler@etnetera.cz). Thank you. |
Closing this for now. Feel free to reopen if you have more information on this topic. |
hello,When the app is I use this, very high CPU。Especially hot lead to equipment。
This thing when I commented code, this phenomenon is gone.
ex:
//PiwikTracker
// [PiwikTracker sharedInstanceWithSiteID:PiwikProductionSiteId baseURL:[NSURL URLWithString:PiwikProductionServerURL]];
// [PiwikTracker sharedInstance].includeDefaultCustomVariable = NO;
// [PiwikTracker sharedInstance].dispatchInterval = 5;
The text was updated successfully, but these errors were encountered: