Hi,
This is a concurrency problem, can you try this?
modelBuilder.Entity<DatabaseBlobContainer>(b => { b.CollectionName = BlobStoringDatabaseDbProperties.DbTablePrefix + "BlobContainers"; b.BsonMap.MapProperty(x => x.Name).SetIsRequired(true); });
Thanks, but how it will fix problem, the name was not already empty? Shouldn't we create uniqe index with name and tenantId if we are going to solve it at database level?
Also, this is my base class for backgroundjobs
Could this be a side effect? (Notification table like hangfire queue table to track user job status)
using Exchanger.Roles;
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Volo.Abp.BackgroundJobs;
using Volo.Abp.Emailing;
using Volo.Abp.Identity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Timing;
using Volo.Abp.Uow;
namespace Exchanger.Ewp.Notifications
{
public abstract class NotificationJobBase<T> : AsyncBackgroundJob<T> where T : NotificationJobArgs
{
public ICurrentTenant CurrentTenant { get; set; }
public IUnitOfWorkManager UnitOfWorkManager { get; set; }
public INotificationRepository NotificationRespository { get; set; }
public IClock Clock { get; set; }
public IEmailSender EmailSender { get; set; }
public IIdentityUserRepository IdentityUserRepository { get; set; }
public ILookupNormalizer LookupNormalizer { get; set; }
protected abstract Task JobMethod(T args);
public override async Task ExecuteAsync(T args)
{
using (CurrentTenant.Change(args.CurrentTenantId, args.CurrentTenantName))
{
Exception jobException = null;
Notification notification = null;
using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: false))
{
//get job related notification data
notification = await NotificationRespository.FindAsync(args.NotificationId);
if (notification == null)
return;
if (notification.ProcessState == NotificationJobState.Cancel ||
notification.ProcessState == NotificationJobState.InProcess ||
notification.ProcessState == NotificationJobState.Completed)
return;
notification.SetState(NotificationJobState.InProcess);//to show user job working
await NotificationRespository.UpdateAsync(notification);
await uow.CompleteAsync();
}
bool isError = false;
var uowJob = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true);
try
{
await JobMethod(args); // <== this is actual job method overrided from parent class
notification.AddTransactionHistory(new Transaction(Clock.Now)
{
ProcessMessage = "Success",
IsSuccess = true
});
await uowJob.CompleteAsync();
}
catch (Exception ex)
{
jobException = ex;
notification.AddTransactionHistory(new Transaction(Clock.Now)
{
ProcessMessage = ex.Message,
ProcessMessageDetail = ex.StackTrace
});
isError = true;
await uowJob.RollbackAsync();
}
finally
{
uowJob.Dispose();
}
using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: false))
{
if (!notification.ManuallyTriggered)
await SendEmail(args, isError);
if (notification.TransactionHistory.Any(p => p.IsSuccess))
{
notification.SetState(NotificationJobState.Completed);
}
else
{
notification.SetState(NotificationJobState.Fail);
}
await NotificationRespository.UpdateAsync(notification);
await uow.CompleteAsync();
}
//throw if exception exist for hangfire retry
if (jobException != null)
throw jobException;
}
}
private async Task SendEmail(T args, bool isError)
{
...
}
}
}
Hello,
Today, I start to get error like "Sequence contains more than one element" when my hangfire job execute. I found problem when I debug method on line below
await _blobContainer.SaveAsync(agreementContainer.PartnerCopy.PdfBinaryId.ToString(), iiaAgreementResponse.Pdf);
I found the line where the error came from https://github.com/abpframework/abp/blob/e3e1779de6df5d26f01cdc8e99ac9cbcb3d24d3c/modules/blob-storing-database/src/Volo.Abp.BlobStoring.Database.Domain/Volo/Abp/BlobStoring/Database/DatabaseBlobProvider.cs#L129
Then I checked database and I've seen repetitive data formed somehow on AbpBlobContainer table (for same container name & tenant)
I using mongodb replication with 3 nodes for enable transaction.
I think it happened when two requests came in at the same time..
How it could be? Does it not lock mongo db collections until transaction finish? Or should we put lock here?
Thanks for help, I guess this feature is new, I was not seen before.
Hello, I created microservice project. If we want seprate database, how can we configure that? Because we have more than one connection string each service, but saas tenant table contain one right?
We are having the same issue. This affects our ability to deploy our projects to a production site and needs to be considered high priority. At the moment, I cannot deploy a necessary hotfix to our production site due to the problem.
All attempts to download a Nuget package fail with the following error.
Retrying 'FindPackagesByIdAsync' for source 'https://nuget.abp.io/d394cc89-2855-4bc7-83c1-6af024b7ceef/v3/package/volo.abp.featuremanagement.domain/index.json'. Response status code does not indicate success: 500 (Internal Server Error).
same here
Hello, our pipelines not working because of yours server not work.
problem was account controller.
Just I need empty working module project with tiered hosted blazor server example I can give my email addresss
Can you create example module project with tiered blazor server.