-
Notifications
You must be signed in to change notification settings - Fork 753
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
Exception Alert for Social.Messaging.MessageRecipient #3624
Comments
What version did you upgrade from? |
9.4.4 |
We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically. |
This issue has been closed automatically due to inactivity (as mentioned 14 days ago). Feel free to re-open the issue if you believe it is still relevant. |
Same here after upgrading from DNN 8.0.4 to 9.8.1. Please reopen! |
The error messages stopped to appear in the logs after moving some (or all) message recipients into archive: update dbo.CoreMessaging_MessageRecipients set Archived = 1 where Archived = 0 Still have no idea what would be causing this. |
Wonder if this is due to messages not archived possibly from users that may have been deleted. IE: Recipient received a message from sender. Later the sender or recipient is deleted. The non delete sender or recipient later archives the message. On a site the mimics my production I ran a "Select * from dbo.CoreMessaging_MessageRecipients". The list contains UserID's that when looking at the limited number of users on this site don't match except for a 1 or 2. UserIDs.pdf is from running "select UserID from users" I tried creating this on a local test/dev site (DNNdev.me) running 9.8.1 with symbols and was unable to duplicate it. Of course kind of hard to recreate if the condition is not known. On my production site I only seen it once in a while. Messaging is not widely used on it. If the above is of any significance I can run the same on my production site to see if the same correlation between messages and userIDs. |
I've checked select count(*) from dbo.CoreMessaging_MessageRecipients where UserID not in (select UserID from dbo.Users) But there are none in my case. |
Well, That might rule that theory out. Just for info reasons this is what my environments look like. FYI: I think there is an error in your SQL "is not in" Test site the Mimics production: 13
Test site the Mimics production: 13 Looking at my production site with users that have been deleted over the years. Not sure of the full impact of this, but maybe this is something that should be looked into. Does this pose any issues with the old orphaned data points? Seems kind of concerning that there doesn't appear to be any cleanup or purging of data. I would think if user is deleted the archived or stored messages references should be purged. Considering I only have 1004 messages in the list. Oldest one being from 2012. |
You are right, error corrected. |
I'm having the same issue coming from an original install of 6.0.0 and moving to 9.8.1 I applied Roman's fix to stop the logs getting flooded with these message
|
A user was messaging me earlier today. Went in a looked at the logs and I don’t think this has anything to do with actual archiving of messages. The reason being I have these message now in the log that seem to correlate to myself and this user. It seems like it might be happening during creating of the messaging interface/view. The reason for this thought is looking in the logs and can see my login and then shortly after the error event. Which would correlate to logging and immediately click the message notification in the menu bar. 2021-02-21 10:27:26,135 [generic262][Thread:52][ERROR] DotNetNuke.Services.Exceptions.Exceptions - System.IndexOutOfRangeException: Archived |
@sleupold it looks like this issue may have been introduced in #3540. That script edited Previously: Dnn.Platform/DNN Platform/Website/Providers/DataProviders/SqlDataProvider/07.02.00.SqlDataProvider Lines 472 to 481 in 714db32
As of 9.5.0: Dnn.Platform/DNN Platform/Website/Providers/DataProviders/SqlDataProvider/09.05.00.SqlDataProvider Lines 209 to 229 in 714db32
However, that SQL is only called by code which materializes that data into Lines 452 to 456 in a37c4f8
Dnn.Platform/DNN Platform/Library/Services/Social/Messaging/MessageRecipient.cs Lines 90 to 100 in 714db32
|
Just a little bump on this so Stale Bot doesn't close it out and it dies on the vine. |
I added four missing columns to the procedure and we will see if it fixes the errors. |
@prjrvp Did your test work? |
I had to add every single remaining field R.(fieldname) before it worked. I will note that while this is failing messages are NOT going out. |
Weird as have not noticed messages not working. I have received messages and responded to messages without issue. Just each one creates a log entry. |
My system sends out heavy messages (about 35 a day) which dropped to a trickle of 1 to 2 a day. After I finally fixed it, the number went back up to 35 a day. In the meantime, I learned that users who were to receive these message had received nothing from us. If the issue was failing and restarting from where it left off, the messages would eventually have been sent. This did not happen. It moved forward in the queue without actually sending the message to the users. Now, if your users do not use the email and simply look at their message queue on the website, they will not miss messages. They are on the website, just not being sent. I can not tell you why some messages went out while others did not. |
Our site is minimal messages but I was getting the emails also when I was testing and outside of testing. Weird we're having different results. Maybe it has a message volume component also. Would be nice to get this defect resolved though. |
Agreed. It is an easy fix on two procedures that you can do live in the production environment using SSMS. |
We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically. |
Seems like the fix is known for this. I'm not a developer or I would do a PR to resolve. Would be nice if someone could take a look at this and provide a fix. |
@prjrvp can you share the changes you did to resolve this? |
Yes, these are the changes required to fix this issue once and for all: /****** Object: StoredProcedure [dbo].[CoreMessaging_GetNextMessagesForDigestDispatch] Script Date: 7/31/2021 6:40:55 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[CoreMessaging_GetNextMessagesForDigestDispatch]
@Frequency INT,
@SchedulerInstance UNIQUEIDENTIFIER,
@BatchSize INT
AS
BEGIN
UPDATE R
SET [EmailSchedulerInstance] = @SchedulerInstance,
[LastModifiedOnDate] = GetDate()
FROM dbo.[CoreMessaging_MessageRecipients] R
JOIN (SELECT TOP (@BatchSize)
UserID
FROM dbo.[vw_MessagesForDispatch]
WHERE [EmailSchedulerInstance] IS NULL
AND [EmailFrequency] = @Frequency
GROUP BY UserID
ORDER BY UserID) D ON R.UserID = D.UserID
SELECT M.[PortalID],
M.[NotificationTypeID],
M.[To],
M.[From],
M.[Subject],
M.[Body],
M.[SenderUserID],
M.[ExpirationDate],
M.[Context],
R.[RecipientID],
R.[MessageID],
R.[UserID],
R.[EmailSent],
R.[Read],
R.[Archived],
R.[EmailSchedulerInstance],
R.[CreatedByUserID],
R.[CreatedOnDate],
R.[LastModifiedByUserID],
R.[LastModifiedOnDate],
R.[SendToast]
FROM dbo.[CoreMessaging_MessageRecipients] R
JOIN dbo.[CoreMessaging_Messages] M ON R.MessageID = M.MessageID
WHERE [EmailSent] = 0 -- Filter these 4 columms to use proper index
AND [Read] = 0
AND [Archived] = 0
AND [EmailSchedulerInstance] = @SchedulerInstance
ORDER BY --[PortalID],
[UserID],
[RecipientID] DESC
END; -- Procedure Change Stored procedure /****** Object: StoredProcedure [dbo].[CoreMessaging_GetNextMessagesForInstantDispatch] Script Date: 7/31/2021 6:44:12 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[CoreMessaging_GetNextMessagesForInstantDispatch]
@SchedulerInstance UNIQUEIDENTIFIER,
@BatchSize INT
AS
BEGIN
-- reset possibly remaining records from any previous run of this SchedulerInstance:
UPDATE dbo.[CoreMessaging_MessageRecipients]
SET [EmailSchedulerInstance] = Null,
[LastModifiedOnDate] = GetDate()
WHERE [EmailSchedulerInstance] = @SchedulerInstance
AND [EmailSent] = 0 AND [Read] = 0 AND [Archived] = 0;
-- reset possibly remaining outdated records from other instances:
UPDATE dbo.[CoreMessaging_MessageRecipients]
SET [EmailSchedulerInstance] = Null
WHERE [EmailSent] = 0 AND [Read] = 0 AND [Archived] = 0
AND [EmailSchedulerInstance] Is Not Null AND [LastModifiedOnDate] < DateAdd(hh, -2, GetDate());
-- mark messages for dispatch, so they won't be handled by another SchedulerInstance:
UPDATE TOP (@BatchSize) R
SET [EmailSchedulerInstance] = @SchedulerInstance,
[LastModifiedOnDate] = GetDate()
FROM dbo.[CoreMessaging_MessageRecipients] AS R
INNER JOIN dbo.[CoreMessaging_Messages] AS M ON R.MessageID = M.MessageID
LEFT JOIN dbo.[CoreMessaging_UserPreferences] AS P ON R.UserID = P.UserID AND M.PortalID = P.PortalID
WHERE R.[EmailSent] = 0 AND R.[Read] = 0 AND R.[Archived] = 0 AND EmailSchedulerInstance IS NULL
AND CASE
WHEN M.NotificationTypeID IS Null
THEN IsNull(P.[MessagesEmailFrequency], 0) -- direct mails are sent immediately by default
ELSE IsNull(p.[NotificationsEmailFrequency], 2) -- notifications are sent as daily digest by default
END = 0;
SELECT M.[PortalID],
M.[NotificationTypeID],
M.[To],
M.[From],
M.[Subject],
M.[Body],
M.[SenderUserID],
M.[ExpirationDate],
M.[Context],
R.[RecipientID],
R.[MessageID],
R.[EmailSent],
R.[Read],
R.[Archived],
R.[EmailSchedulerInstance],
R.[UserID],
R.[CreatedByUserID],
R.[CreatedOnDate],
R.[LastModifiedByUserID],
R.[LastModifiedOnDate],
R.[SendToast]
FROM dbo.[CoreMessaging_MessageRecipients] R
JOIN dbo.[CoreMessaging_Messages] M ON R.MessageID = M.MessageID
WHERE [EmailSent] = 0 -- Filter these columms 4 to use proper index
AND [Read] = 0
AND [Archived] = 0
AND [EmailSchedulerInstance] = @SchedulerInstance
ORDER BY --[PortalID],
[UserID],
[RecipientID]
END; -- Procedure |
Fixes dnnsoftware#3624 Co-authored-by: @prjrvp <9609997+prjrvp@users.noreply.github.com>
In addition to modifying the two procedures mentioned above, and updating table CoreMessaging_MessageRecipients setting Archived = 1, for an ordinary user it's OK; but entering the site with host or admin user, it logs again the error. It seems this is caused by other type of notifications like from Feedback and other modules. AbsoluteURL:/Default.aspx Also from other sources:
|
What is the purpose of SELECT query at the end of these procedures. How it's result will be used? Although modified the two procedures, the DNN log continuously records the same error message of this issue. |
Description of bug
Since upgrade to DNN 9.5.0 I've noticed a new error in the admin log.
Steps to reproduce
Not clear at the moment. I think it's when a user archives messages in Message Center.
Screenshots
Error information
From Log File:
2020-03-11 00:29:32,742 [generic262][Thread:57][ERROR] DotNetNuke.Services.Exceptions.Exceptions - System.IndexOutOfRangeException: Archived
at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at System.Data.SqlClient.SqlDataReader.get_Item(String name)
at DotNetNuke.Services.Social.Messaging.MessageRecipient.Fill(IDataReader dr)
at DotNetNuke.Common.Utilities.CBO.FillObjectFromReader(Object objObject, IDataReader dr)
2020-03-11 10:15:49,658 [generic262][Thread:12][ERROR] DotNetNuke.Services.Exceptions.Exceptions - System.IndexOutOfRangeException: Archived
at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at System.Data.SqlClient.SqlDataReader.get_Item(String name)
at DotNetNuke.Services.Social.Messaging.MessageRecipient.Fill(IDataReader dr)
at DotNetNuke.Common.Utilities.CBO.FillObjectFromReader(Object objObject, IDataReader dr)
Affected version
9.5.0 is all I have to test with at the moment.
Affected browser
N/A
The text was updated successfully, but these errors were encountered: