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

Error - "Error updating the user record because of th enull user id" shown as a dialog randomly #1008

Closed
amirghm opened this issue May 7, 2020 · 17 comments

Comments

@amirghm
Copy link

amirghm commented May 7, 2020

Description:

Recently I see an issue in our application, this message is shown as a dialog randomly when I work with our app:
image

Environment

  • Android API Version: 29 and 28 tested
  • SDK Version: 3.13.2

Steps to Reproduce Issue:

  1. open your app
  2. work with your app
  3. this dialog shows randomly

Anything else:

(crash stacktraces, as well as any other information here)

I see also this error appeared in the logcat also: "Error updating the user record because of th enull user id"

@mgray88
Copy link

mgray88 commented May 12, 2020

Follow up to this with stacktrace:

E/OneSignal: Error updating the user record because of th enull user id
W/System.err: java.lang.InterruptedException
W/System.err:     at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1244)
W/System.err:     at java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:336)
W/System.err:     at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:384)
W/System.err:     at com.onesignal.OneSignalSyncServiceUtils$SyncRunnable.run(OneSignalSyncServiceUtils.java:236)
W/System.err:     at java.lang.Thread.run(Thread.java:764)

edit - Earlier stacktrace at app launch:

W/System.err: java.lang.InterruptedException
W/System.err:     at java.lang.Object.wait(Native Method)
W/System.err:     at java.lang.Object.wait(Object.java:422)
W/System.err:     at java.lang.Thread.join(Thread.java:1268)
W/System.err:     at com.onesignal.OneSignalRestClient.makeRequest(OneSignalRestClient.java:118)
W/System.err:     at com.onesignal.OneSignalRestClient.putSync(OneSignalRestClient.java:95)
W/System.err:     at com.onesignal.UserStateSynchronizer.doPutSync(UserStateSynchronizer.java:315)
W/System.err:     at com.onesignal.UserStateSynchronizer.internalSyncUserState(UserStateSynchronizer.java:245)
W/System.err:     at com.onesignal.UserStateSynchronizer.syncUserState(UserStateSynchronizer.java:213)
W/System.err:     at com.onesignal.OneSignalStateSynchronizer.syncUserState(OneSignalStateSynchronizer.java:98)
W/System.err:     at com.onesignal.OneSignalSyncServiceUtils$SyncRunnable.run(OneSignalSyncServiceUtils.java:246)
W/System.err:     at java.lang.Thread.run(Thread.java:764)
E/OneSignal: Error updating the user record because of th enull user id

@rgomezp
Copy link
Contributor

rgomezp commented May 18, 2020

Howdy,
Could you please include your initialization code? Make sure it is the first thing you are calling from the OneSignal SDK.

@mgray88
Copy link

mgray88 commented May 18, 2020

We have a wrapper around the OneSignal sdk, it's initialized as such:

init {
    try {
        OneSignal.startInit(context)
                .unsubscribeWhenNotificationsAreDisabled(true)
                .inFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
                .setNotificationReceivedHandler(this)
                .setNotificationOpenedHandler(this)
                .init()
        OneSignal.idsAvailable { userId: String?, registrationId: String? ->
            Timber.v { "idsAvailable, user: $userId reg: $registrationId" }
            if (userId != null) {
                sharedPrefs.edit().putString("playerId", userId).apply()
                Sentry.setExtra("playerId", userId)
            }
        }
        OneSignal.addSubscriptionObserver(this)
    } catch (e: Exception) {
        Timber.e(e)
    }
}

context is passed in by Dagger as the ApplicationContext. The class is annotated with @Singleton

@amirghm
Copy link
Author

amirghm commented May 19, 2020

This is called in application onCreate:

OneSignal.startInit(this)
            .setNotificationOpenedHandler(NotificationClickHandler(applicationContext))
            .inFocusDisplaying(OneSignal.OSInFocusDisplayOption.None)
            .unsubscribeWhenNotificationsAreDisabled(true)
            .init()

I also disable this error by this code

if (BuildConfig.DEBUG) {
     OneSignal.setLogLevel(OneSignal.LOG_LEVEL.NONE, OneSignal.LOG_LEVEL.NONE)
}

Which previously set to LOG_LEVEL.ERROR

@mgray88
Copy link

mgray88 commented May 26, 2020

This is still occurring with the latest 3.14.0

W/System.err: java.lang.InterruptedException
W/System.err:     at java.lang.Object.wait(Native Method)
W/System.err:     at java.lang.Object.wait(Object.java:422)
W/System.err:     at java.lang.Thread.join(Thread.java:1268)
W/System.err:     at com.onesignal.OneSignalRestClient.makeRequest(OneSignalRestClient.java:118)
W/System.err:     at com.onesignal.OneSignalRestClient.putSync(OneSignalRestClient.java:95)
W/System.err:     at com.onesignal.UserStateSynchronizer.doPutSync(UserStateSynchronizer.java:315)
W/System.err:     at com.onesignal.UserStateSynchronizer.internalSyncUserState(UserStateSynchronizer.java:245)
W/System.err:     at com.onesignal.UserStateSynchronizer.syncUserState(UserStateSynchronizer.java:213)
W/System.err:     at com.onesignal.OneSignalStateSynchronizer.syncUserState(OneSignalStateSynchronizer.java:98)
W/System.err:     at com.onesignal.OneSignalSyncServiceUtils$SyncRunnable.run(OneSignalSyncServiceUtils.java:246)
W/System.err:     at java.lang.Thread.run(Thread.java:764)
E/OneSignal: Error updating the user record because of the null user id

This happens after app shutdown, and the service restarts the application process in the background. At the time this error is thrown, the application has successfully started, OneSignal has successfully initialized, and the idsAvailable callback has been called with both userId and registrationId set.

3 1/2 minutes later with the app still closed, the following is output in the logcat:

W/System.err: java.lang.InterruptedException
W/System.err:     at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1244)
W/System.err:     at java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:336)
W/System.err:     at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:384)
W/System.err:     at com.onesignal.OneSignalSyncServiceUtils$SyncRunnable.run(OneSignalSyncServiceUtils.java:236)
W/System.err:     at java.lang.Thread.run(Thread.java:764)
E/OneSignal: Error updating the user record because of the null user id

@olashiku
Copy link

still experiencing this issue, Please has anyone soled it ?

@manishpatelgt
Copy link

I am seeing in my logcat. I just updated all the dependencies with latest versions but still


java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:422)
at java.lang.Thread.join(Thread.java:1290)
at com.onesignal.OneSignalRestClient.makeRequest(OneSignalRestClient.java:118)
at com.onesignal.OneSignalRestClient.putSync(OneSignalRestClient.java:95)
at com.onesignal.UserStateSynchronizer.doPutSync(UserStateSynchronizer.java:315)
at com.onesignal.UserStateSynchronizer.internalSyncUserState(UserStateSynchronizer.java:245)
at com.onesignal.UserStateSynchronizer.syncUserState(UserStateSynchronizer.java:213)
at com.onesignal.OneSignalStateSynchronizer.syncUserState(OneSignalStateSynchronizer.java:98)
at com.onesignal.OneSignalSyncServiceUtils$SyncRunnable.run(OneSignalSyncServiceUtils.java:246)
at java.lang.Thread.run(Thread.java:784)

I am using

dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.7, 0.99.99]'
    }

and

implementation "com.onesignal:OneSignal:3.14.0"

@felipechavez
Copy link

I have the same problem, but with latest Xamarin SDK 3.8.2. Im not receiving notifications with the closed app and NotificationExtender implemented for Android

@cgsbanno
Copy link

cgsbanno commented Jun 30, 2020

Is there an update? My company is about to go live with OneSignal and this is an issue. Can this be worked around by setLogLevel() to OneSignal.LOG_LEVEL.NONE (for visualLevel)? Seeking confirmation that the rendering of this dialog is caused by setting the visualLevel LOG_LEVEL to ERROR or lower

@rgomezp
Copy link
Contributor

rgomezp commented Jul 1, 2020

@cgsbanno ,
setLogLevel is useful for debugging. But even then in most cases the visualLevel should be set to none since it is much easier to capture the output in a connected device's logcat. Are you setting the log level in production?

In either case, the error is an issue on its own that we are investigating.

Thank you everyone for your patience.

@cgsbanno
Copy link

cgsbanno commented Jul 1, 2020

@rgomezp Yes I've already done that, I was just looking for confirmation that this error dialog was being rendered on devices due to visualLevel and not for some other reason (which you've confirmed). And yes visualLevel was only set to non-NONE on our debug builds.

@cgsbanno
Copy link

cgsbanno commented Jul 1, 2020

In either case, the error is an issue on its own that we are investigating.

Per previous reports, it's my understanding that the underlying issue under some circumstances is preventing users from receiving push notifications, is this correct?

@rgomezp
Copy link
Contributor

rgomezp commented Jul 9, 2020

@cgsbanno ,
After further investigation, it seems this issue is related to location and not push at all so this shouldn't be preventing users from receiving push notifications. We are currently working to resolve it. Cheers

@Thaina
Copy link

Thaina commented Jul 30, 2020

@rgomezp I am using unity SDK and my app haven't got any noti too, cannot even send test noti (it sent and delivered but not being shown in device, ios is fine with the same noti)

There was this same log message from my android. Is this problem still persist? Is it the same problem?

07-30 16:26:51.592 17831 18612 I OneSignal: Location permissions not added on AndroidManifest file
07-30 16:26:51.593 17831 18612 E OneSignal: Error updating the user record because of the null user id

@mikechoch
Copy link
Contributor

This is a misleading log and is fixed in Android SDK release 3.15.2

@Thaina
Copy link

Thaina commented Jul 31, 2020

@mikechoch If so I have created OneSignal/OneSignal-Unity-SDK#310 is it related?

@rgomezp
Copy link
Contributor

rgomezp commented Aug 4, 2020

@Thaina ,
From first glance it looks like the same error. Yes this should be resolved and will be included in the next Unity release.

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

No branches or pull requests

9 participants