Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "Ricavir"

Answer

Hi @ismcagdas,

Thanks for your feedback. It's a good news. I also agree that it's too soon right now.

Hi,

I'm also getting a lot of SecurityTokenExpiredException exceptions.

We are having these exeptions with all tenants in the same timezone.

These exceptions are happening mainly with following endpoints :

  • POST /api/TokenAuth/Authenticate
  • POST /signalr/negociate

SecurityTokenExpiredException is sometimes followed by SecurityTokenInvalidSignatureException.

Our app is having performance issues and we are tracking these exceptions on AppInsights.

I don't know how to reproduce this and help you guys to find the issue...

Please, tell me how can I help finding this issue ?

Hi @ismcagdas,

In general the app is running in one instance, but can be two according to CPU load. The job is fired manually by users from the web app, so the frequency depends. It can be done twice in short period. I'm not updating any data on EF on this jobs, therefore I suspect an issue while updating backgoundjob status in the database.

Great @ismcagdas, we can close this ticket and follow the Github issue.

Hi @ismcagdas,

I don't see async with sync usage. Here is the backgroundjob code :

public class FileGeneratorEventJob : AsyncBackgroundJob<FileGeneratorEventJobArgs>, ITransientDependency
    {
        private readonly IRepository<DocumentTemplate> _documentTemplateRepository;
        private readonly IFileGenerator _fileGenerator;
        private readonly IUnitOfWorkManager _unitOfWorkManager;
        private readonly IAppNotifier _appNotifier;
        private readonly IObjectMapper _objectMapper;
        private readonly IEventQueryManager _eventQueryManager;

        public FileGeneratorEventJob(IRepository<DocumentTemplate> documentTemplateRepository,
                                                IFileGenerator fileGenerator,
                                                IUnitOfWorkManager unitOfWorkManager,
                                                IObjectMapper objectMapper,
                                                IAppNotifier appNotifier,
                                                IEventQueryManager eventQueryManager)
        {
            _documentTemplateRepository = documentTemplateRepository;
            _fileGenerator = fileGenerator;
            _appNotifier = appNotifier;
            _unitOfWorkManager = unitOfWorkManager;
            _objectMapper = objectMapper;
            _eventQueryManager = eventQueryManager;
        }

        public override async Task ExecuteAsync(FileGeneratorEventJobArgs args)
        {
            await _unitOfWorkManager.WithUnitOfWorkAsync(async () =>
            {
                using (UnitOfWorkManager.Current.SetTenantId(args.TenantId))
                {
                    using (CultureInfoHelper.Use(await SettingManager.GetSettingValueForTenantAsync(LocalizationSettingNames.DefaultLanguage, args.TenantId)))
                    {
                        try
                        {
                            var documentTemplate = await _documentTemplateRepository.FirstOrDefaultAsync(args.DocumentTemplateId);
                            if (documentTemplate == null)
                                return;
                            if (documentTemplate.Extension != TemplateExtension.Word)
                                return;

                            var filteredEvents = _eventQueryManager.GetEventsQueryable(args.EventForecastsInput);

                            var events = await filteredEvents.Take(AppConsts.MaxExportSize).OrderBy(args.EventsInput.Sorting).ToListAsync();

                            if (events.IsNullOrEmpty())
                                return;

                            var dynamicFields = new List<DocumentTemplateField>();
                            if (args.DynamicFields != null)
                            {
                                dynamicFields = _objectMapper.Map<List<DocumentTemplateField>>(args.DynamicFields);
                            }

                            DataExporting.FileObject file = null;
                            file = await _fileGenerator.GenerateFileAsync(events, args.DocumentTemplatePath, args.DocumentTemplatePrefixName, args.DocumentTemplateId, dynamicFields, args.ConvertToPdf, args.MergeFields, args.SaveAsFileReference, args.TenantId);

                            await _appNotifier.FileGenerationJobSucceedAsync(file, "FileGenerationJobForEventSucceed", args.UserIdentifier);
                        }
                        catch (Exception ex)
                        {
                            await _appNotifier.FileGenerationJobFailedAsync("FileGenerationJobForEventFailed", args.UserIdentifier);
                        }
                    }
                }
            });
        }

and it is called like this :


` await _backgroundJobManager.EnqueueAsync&lt;FileGeneratorEventJob, FileGeneratorEventJobArgs&gt;(new FileGeneratorEventJobArgs
                {
                    EventsInput = input.eventsInput,
                    ConvertToPdf = input.templateInput.ConvertToPdf,
                    DocumentTemplateId = input.templateInput.DocumentTemplateId,
                    DocumentTemplatePath = documentPath,
                    DocumentTemplatePrefixName = documentTemplate.Code,
                    DynamicFields = input.templateInput.DynamicFields,
                    MergeFields = input.templateInput.MergeFields,
                    SaveAsFileReference = input.templateInput.SaveAsFileReference,
                    TenantId = AbpSession.TenantId.Value,
                    UserIdentifier = user.ToUserIdentifier()
                });`

Hi @ismcagdas,

Thks for your feedback. I was not able to reproduce in development. I created an issue on github : https://github.com/aspnetzero/aspnet-zero-core/issues/4088

  • Abp 6.4
  • Angular 12
  • .NET 5

Hi,

I'm getting some warning exceptions with background workers. Can you please advise ?

Here is the exception :

WARN 2021-11-09 13:33:48,021 [76 ] Abp.BackgroundJobs.BackgroundJobManager - Abp.Domain.Uow.AbpDbConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
---&gt; Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ThrowAggregateUpdateConcurrencyException(Int32 commandIndex, Int32 expectedRowsAffected, Int32 rowsAffected)
at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeResultSetWithoutPropagationAsync(Int32 commandIndex, RelationalDataReader reader, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeAsync(RelationalDataReader reader, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(DbContext _, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Abp.EntityFrameworkCore.AbpDbContext.SaveChangesAsync(CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at Abp.EntityFrameworkCore.AbpDbContext.SaveChangesAsync(CancellationToken cancellationToken)
at Abp.Zero.EntityFrameworkCore.AbpZeroCommonDbContext`3.SaveChangesAsync(CancellationToken cancellationToken)
at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.SaveChangesAsync()
at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.CompleteUowAsync()
at Abp.Domain.Uow.UnitOfWorkBase.CompleteAsync()
at Abp.Domain.Uow.UnitOfWorkManagerExtensions.WithUnitOfWorkAsync[TResult](IUnitOfWorkManager manager, Func`1 action, UnitOfWorkOptions options)
at Abp.BackgroundJobs.BackgroundJobStore.UpdateAsync(BackgroundJobInfo jobInfo)
at Abp.BackgroundJobs.BackgroundJobManager.TryUpdateAsync(BackgroundJobInfo jobInfo)
Abp.Domain.Uow.AbpDbConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
---&gt; Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ThrowAggregateUpdateConcurrencyException(Int32 commandIndex, Int32 expectedRowsAffected, Int32 rowsAffected)
at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeResultSetWithoutPropagationAsync(Int32 commandIndex, RelationalDataReader reader, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeAsync(RelationalDataReader reader, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(DbContext _, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Abp.EntityFrameworkCore.AbpDbContext.SaveChangesAsync(CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at Abp.EntityFrameworkCore.AbpDbContext.SaveChangesAsync(CancellationToken cancellationToken)
at Abp.Zero.EntityFrameworkCore.AbpZeroCommonDbContext`3.SaveChangesAsync(CancellationToken cancellationToken)
at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.SaveChangesAsync()
at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.CompleteUowAsync()
at Abp.Domain.Uow.UnitOfWorkBase.CompleteAsync()
at Abp.Domain.Uow.UnitOfWorkManagerExtensions.WithUnitOfWorkAsync[TResult](IUnitOfWorkManager manager, Func`1 action, UnitOfWorkOptions options)
at Abp.BackgroundJobs.BackgroundJobStore.UpdateAsync(BackgroundJobInfo jobInfo)
at Abp.BackgroundJobs.BackgroundJobManager.TryUpdateAsync(BackgroundJobInfo jobInfo)

I tried to replace ApplicationBootstrapper.InitializeIfNeeds<XamarinAndroidModule>() by a new method called ApplicationBootstrapper.Initialize<XamarinAndroidModule>() which initialize application IOC container each time.

At first, it seems to be better but I had an app crash as follows :

11-07 17:49:32.384 31604 31604 E AndroidRuntime: android.runtime.JavaProxyThrowable: System.ArgumentException: Facility of type 'Castle.Facilities.Logging.LoggingFacility' has already been registered with the container. Only one facility of a given type can exist in the container.
11-07 17:49:32.384 31604 31604 E AndroidRuntime:   at Castle.MicroKernel.DefaultKernel.AddFacility (Castle.MicroKernel.IFacility facility) [0x0004e] in <e8e139fd05dd4c49be84efef707f01f4>:0
11-07 17:49:32.384 31604 31604 E AndroidRuntime:   at Castle.MicroKernel.DefaultKernel.AddFacility[T] (System.Action`1[T] onCreate) [0x00010] in &lt;e8e139fd05dd4c49be84efef707f01f4&gt;:0
11-07 17:49:32.384 31604 31604 E AndroidRuntime:   at Castle.Windsor.WindsorContainer.AddFacility[T] (System.Action`1[T] onCreate) [0x00000] in <e8e139fd05dd4c49be84efef707f01f4>:0
11-07 17:49:32.384 31604 31604 E AndroidRuntime:   at MyORG.MyApp.Core.ApplicationBootstrapper.Initialize[T] () [0x00038] in <3139bd716c9d44ebbfcb67ec47cb44cb>:0
11-07 17:49:32.384 31604 31604 E AndroidRuntime:   at MyORG.MyApp.Activities.SplashActivity.OnResume () [0x00017] in <e77a7bfb8b904473b3eb7dd998dd0ff6>:0
11-07 17:49:32.384 31604 31604 E AndroidRuntime:   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in <1b39a03c32ec46258a7821e202e0269f>:0
11-07 17:49:32.384 31604 31604 E AndroidRuntime:   at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <b868e022fd60450992c00cdaff974113>:0
11-07 17:49:32.384 31604 31604 E AndroidRuntime:   at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <b868e022fd60450992c00cdaff974113>:0
11-07 17:49:32.384 31604 31604 E AndroidRuntime:   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <b868e022fd60450992c00cdaff974113>:0
11-07 17:49:32.384 31604 31604 E AndroidRuntime:   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.38(intptr,intptr)
11-07 17:49:32.384 31604 31604 E AndroidRuntime:        at mono.java.lang.RunnableImplementor.n_run(Native Method)
11-07 17:49:32.384 31604 31604 E AndroidRuntime:        at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
11-07 17:49:32.384 31604 31604 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:938)
11-07 17:49:32.384 31604 31604 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
11-07 17:49:32.384 31604 31604 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:201)
11-07 17:49:32.384 31604 31604 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:288)
11-07 17:49:32.384 31604 31604 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7842)
11-07 17:49:32.384 31604 31604 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
11-07 17:49:32.384 31604 31604 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
11-07 17:49:32.384 31604 31604 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

So it tells that I can't register a new Container...

Do you have any idea to help me find this bugg ?

Answer

I'm also interested by this :)

Xamarin Forms 4.8 Abp 6.4

Hi @Alper,

A lot of users are getting more and more exceptions on Xamarin Forms Android app like this : https://support.aspnetzero.com/QA/Questions/8484/Android-OnStart-crash The app is on the play store since a long time now and is working well most of the time. I never found the way to reproduce the exception reported by Google... but some days ago we had these exceptions with a new Nexus 5.

Therefore I hope you can help me to found a solution and fix the issue with the details above :

The exception happens in the following usecase :

  • app is running normaly on foreground
  • app is now in background
  • after some time in background, the OS may kill the process (due to timeout or memory space needed)
  • user comes back to the app
  • app starts with the splash screen
  • after splash screen is closed, the app crash
  • user can reopen the app after the crack without any issue
  • this exception is not happening when the app is killed manualy by the user

Here is the Android exception logged :


> 11-06 06:37:48.437 11020 11020 E AndroidRuntime: FATAL EXCEPTION: main
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime: Process: com.MyApp.Mobile, PID: 11020
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime: android.runtime.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:   at MyORG.MyApp.Core.Dependency.DependencyResolver.Resolve[T] () [0x00005] in <1174882f65d4478c861b92e9fc0bd083>:0
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:   at MyORG.MyApp.App.OnStart () [0x0010a] in <1174882f65d4478c861b92e9fc0bd083>:0
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in <1b39a03c32ec46258a7821e202e0269f>:0
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:   at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <b868e022fd60450992c00cdaff974113>:0
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:   at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <b868e022fd60450992c00cdaff974113>:0
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <b868e022fd60450992c00cdaff974113>:0
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:   at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.37(intptr,intptr)
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:        at mono.java.lang.RunnableImplementor.n_run(Native Method)
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:        at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:938)
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:201)
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:288)
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7842)
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
> 11-06 06:37:48.437 11020 11020 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

The exception seems to happen while calling :

await DependencyResolver.Resolve<INavigationService>().InitializeAsync();

Do you know why INavigationService could be null only on app restarts in that specific usecase ?

Could this be linked with the SplashActivity OnResume() when calling

ApplicationBootstrapper.InitializeIfNeeds<XamarinAndroidModule>()

.

Showing 71 to 80 of 325 entries