Skip to content
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

Silent reports are not silent #654

Closed
gkamperis opened this issue Mar 21, 2018 · 11 comments
Closed

Silent reports are not silent #654

gkamperis opened this issue Mar 21, 2018 · 11 comments
Labels

Comments

@gkamperis
Copy link

gkamperis commented Mar 21, 2018

ACRA 5.1.1 + 5.1.2
(migrating from 4.8.2)

Hi,

I have setup ACRA with a custom dialog class and a toast resource id after a sending a report.

Upon startup in the MainActivity onCreate() I do
ACRA.getErrorReporter().handleSilentException(new Exception("TEST"));

This causes my custom dialog and the sent confirmation toast to appear.
My custom dialog shows fine and the report is received.

The issue is that the report is not silent.
Neither the dialog or the toast should be shown.

If I postDelay the silent report for 5000msec the dialog is not shown and I get only the toast.

This did not happen with ACRA 4.8.2
Reports were indeed silent.

CONFIGURATION

       @AcraDialog(reportDialogClass = CustomLogActivity.class)
       @AcraCore(reportFormat = StringFormat.JSON,
               buildConfigClass = XXXX,
               reportContent = {
               },
               resReportSendSuccessToast = R.string.crash_report_msg,
               logcatArguments = {"xxx", "xxx"}
       )
       public class SomeApp extends Application {
       ...
       }

       @Override
       protected void attachBaseContext(Context base) {
       super.attachBaseContext(base);
       CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this)
                .setReportContent(xxxx)
                .setExcludeMatchingSharedPreferencesKeys(xxx)
                .setBuildConfigClass(BuildConfig.class)
                .setReportFormat(StringFormat.JSON);

        builder.getPluginConfigurationBuilder(HttpSenderConfigurationBuilder.class)
                .setUri(xxx)
                .setBasicAuthLogin(xxx)
                .setBasicAuthPassword(xxx)
                .setHttpMethod(HttpSender.Method.PUT)
                .setEnabled(true);
        ACRA.init(this, builder);        
}
@F43nd1r
Copy link
Member

F43nd1r commented Mar 21, 2018

Looks like a race condition between SenderServiceStarter.startService and ApplicationStartupProcessor.approveOneReport.
Fixed it by ignoring just created reports in the startupprocessor.

@gkamperis
Copy link
Author

Thanks for the quick response.

I assume this race starts after the call to handleSilentException() because even if I delay the sending 10sec after app start I still get the toast.

Does your comment mean that the report will be completely ignored and I need to find a way to send it differently?

Will your fix handle the toast as well?
Any idea of when this will be released? or can I try the fix?

Sorry about all the questions... :)

@F43nd1r
Copy link
Member

F43nd1r commented Mar 22, 2018

Does your comment mean that the report will be completely ignored and I need to find a way to send it differently?

No. It was handled twice, which was the problem. Now one ignores it, the other handles it (silently).

Will your fix handle the toast as well?

No. These Toasts are currently unaffected by silent mode. This could probably be enhanced.

Any idea of when this will be released?

As we just had a release, it might be some time, although It'll probably won't take longer than a month.

or can I try the fix?

you can always compile from source: clone the branch with the fix and run the gradle task publishToMavenLocal

@gkamperis
Copy link
Author

So just to clarify... Even though the notification is silent the toast will still appear?
In 4.8.2 there was no toast for a silent report

@F43nd1r
Copy link
Member

F43nd1r commented Mar 22, 2018

Are you talking about the toast interaction or the reportSendSuccess/Failure toast?

@gkamperis
Copy link
Author

I am talking about the report send success... I don't use the toast interaction

@F43nd1r
Copy link
Member

F43nd1r commented Mar 22, 2018 via email

@gkamperis
Copy link
Author

gkamperis commented Mar 22, 2018

My vote goes for changing it... :)

For me personally it is a "breaking change" in behaviour.
Is there a workaround maybe? (apart from disable it all together and show manually)

The migration page helped a lot with going from 4.8 to 5.1 but didn't see any mention of breaking changes.

Is there another page that lists these?

Thanks again for your help

@F43nd1r
Copy link
Member

F43nd1r commented Mar 23, 2018

Except for the notification module, there shouldn't be any breaking changes in behaviour, only in configuration.

I'm afraid there is no workaround, but you can use the attached snapshot.
acra-core-5.1.3-SNAPSHOT.zip

@gkamperis
Copy link
Author

Thanks again for your help and for the snapshot..
I went with "disable it all together and show manually"...
Does the snapshot implement the PR?

@F43nd1r
Copy link
Member

F43nd1r commented Mar 23, 2018

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants