Hi @ismcagdas,
Any news about my previous question for CacheManager ?
Hi @ismcagdas,
I'm using Abp 6.4. I can add a log as you requested and come back to you after.
While analysing this issue on my code, I found that CreateJwtClaims method uses CacheManager... And I just figured out that I'm having issues with CacheManager when my Azure AppService is running on multiple instance. For example, when running with 2 instances, I'm not able to switch user to different tenant accounts (like this https://support.aspnetzero.com/QA/Questions/9502/Switching-tenant-fails-in-mutiple-docker-container-instances-setup)
Therefore, I'm wondering if all these issue are coming from cache management ? (Should I use Redis ?) What do you think ?
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 :
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<FileGeneratorEventJob, FileGeneratorEventJobArgs>(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
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 <e8e139fd05dd4c49be84efef707f01f4>: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 ?
I'm also interested by this :)