"Conversations" error on legacy CS 4.1.40407.4157

Hi all,

Apologies if this is not the best place to post this question, but I really need help and I can see nowhere else to go.

I run a non-commercial free forum site who is running on old Community Server  4.1.40407.4157 (free version) for quite a few years now, and really never felt a compelling reason to upgrade since it has been serving us very well and running smoothly without any problems since ever.

The good days seem to be over however, as from a few weeks ago we started to get a "NullReferenceException: Object reference not set to an instance of an object." error 99% of the time we click on "Conversations" to see the conversation list.

I'm really totally lost about this error, I can only suspect this was caused by some Microsoft .Net update/patch recently published, as nobody touches the server code since day one.

Any help would be greatly appreciated.

Here's the complete track trace as it appears on the server side:

Server Error in '/cafe' Application.

Object reference not set to an instance of an object.

 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]

  CommunityServer.Components.UserSorter.Compare(User x, User y) +459

  System.Collections.Generic.ArraySortHelper`1.SwapIfGreaterWithItems(T[] keys, IComparer`1 comparer, Int32 a, Int32 b) +102

  System.Collections.Generic.ArraySortHelper`1.QuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer) +136

  System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer) +105

[InvalidOperationException: Failed to compare two elements in the array.]

  System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer) +349

  System.Array.Sort(T[] array, Int32 index, Int32 length, IComparer`1 comparer) +207

  System.Collections.Generic.List`1.Sort(Int32 index, Int32 count, IComparer`1 comparer) +95

  CommunityServer.Users.Filter(List`1 usersToFilter, UserQuery query) +102

  CommunityServer.Messages.Controls.ConversationParticipantUserList.get_DataSource() +472

  System.Web.UI.WebControls.Repeater.ConnectToDataSourceView() +184

  System.Web.UI.WebControls.Repeater.GetData() +14

  System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +214

  CommunityServer.Controls.WrappedRepeater.CreateControlHierarchy(Boolean useDataSource) +146

  CommunityServer.Controls.PreTemplatedWrappedRepeaterBase.CreateControlHierarchy(Boolean useDataSource) +372

  System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +53

  CommunityServer.Controls.WrappedRepeater.OnDataBinding(EventArgs e) +15

  System.Web.UI.WebControls.Repeater.DataBind() +75

  CommunityServer.Controls.WrappedRepeater.DataBind() +144

  CommunityServer.Controls.PreTemplatedWrappedRepeaterBase.DataBind() +30

  System.Web.UI.Control.DataBindChildren() +205

  System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +159

  System.Web.UI.Control.DataBind() +15

  System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +124

  System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +435

  CommunityServer.Controls.WrappedRepeater.CreateControlHierarchy(Boolean useDataSource) +146

  CommunityServer.Controls.PreTemplatedWrappedRepeaterBase.CreateControlHierarchy(Boolean useDataSource) +372

  System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +53

  CommunityServer.Controls.WrappedRepeater.OnDataBinding(EventArgs e) +15

  System.Web.UI.WebControls.Repeater.DataBind() +75

  CommunityServer.Controls.WrappedRepeater.DataBind() +144

  CommunityServer.Controls.PreTemplatedWrappedRepeaterBase.DataBind() +30

  System.Web.UI.Control.DataBindChildren() +205

  System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +159

  System.Web.UI.Control.DataBind() +15

  System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +124

  System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +435

  CommunityServer.Controls.WrappedRepeater.CreateControlHierarchy(Boolean useDataSource) +146

  CommunityServer.Controls.PreTemplatedWrappedRepeaterBase.CreateControlHierarchy(Boolean useDataSource) +372

  System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +53

  CommunityServer.Controls.WrappedRepeater.OnDataBinding(EventArgs e) +15

  System.Web.UI.WebControls.Repeater.DataBind() +75

  CommunityServer.Controls.WrappedRepeater.DataBind() +144

  CommunityServer.Controls.PreTemplatedWrappedRepeaterBase.DataBind() +30

  CommunityServer.Controls.PreTemplatedWrappedRepeaterBase.OnLoad(EventArgs e) +32

  System.Web.UI.Control.LoadRecursive() +74

  System.Web.UI.Control.LoadRecursive() +163

  System.Web.UI.Control.LoadRecursive() +163

  System.Web.UI.Control.LoadRecursive() +163

  System.Web.UI.Control.LoadRecursive() +163

  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2603

Version Information: Microsoft .NET Framework Version:2.0.50727.5477; ASP.NET Version:2.0.50727.5479

  • Looking at the error it would suggest that there is a user with one of the following fields null:

    Username

    Email  

    DateCreated

    LastActivity

    TotalPosts

    RecentPosts

    And looking at the code it seems that username is the most likely candidate, which is odd.  Either there is a corrupt entry in you database or something else is creating a user object with invalid data.

  • In reply to Robert Nash:

    Thanks a lot Robert, that would be very easy to find and solve.

    I will check it later today when I have access to the server and let you know.

    Cheers,

  • In reply to Robert Nash:

    No luck.

    I searched for all tables containing column names matching your list and constructed the following simple queries, all of which returned 0 rows:

    select * from aspnet_Users where UserName is null;

    select * from cs_PostsArchive where UserName is null;

    select * from cs_Users where UserName is null;

    select * from aspnet_Membership where Email is null;

    select * from cs_SectionSubscriptions where Email is null;

    select * from cs_UserInvitation where Email is null;

    select * from cs_Users where Email is null;

    select * from cs_Users_OpenID where Email is null;

    select * from cs_ApiKeys where DateCreated is null;

    select * from cs_Exceptions where DateCreated is null;

    select * from cs_Links where DateCreated is null;

    select * from cs_Messaging_Conversations where DateCreated is null;

    select * from cs_Messaging_Messages where DateCreated is null;

    select * from cs_Moderators where DateCreated is null;

    select * from cs_Post_Categories where DateCreated is null;

    select * from cs_PostRating where DateCreated is null;

    select * from cs_Sections where DateCreated is null;

    select * from cs_statistics_Site where DateCreated is null;

    select * from cs_ThreadRating where DateCreated is null;

    select * from cs_TrackedSections where DateCreated is null;

    select * from cs_TrackedThreads where DateCreated is null;

    select * from cs_SectionsRead where LastActivity is null;

    select * from cs_Users where LastActivity is null;

    select * from cs_Sections where TotalPosts is null;

    select * from cs_statistics_Site where TotalPosts is null;

    select * from cs_statistics_User where TotalPosts is null;

    select * from cs_UserProfile where TotalPosts is null;

    Since you have access to the code, can you please let me know what tables are used to store the conversation messages? Maybe if I can build the relationship model of all related tables in a ERD I can then have a look at the existing data and try to find any strange pattern.

    What is most strange is that once in a while the conversations list opens fine, it is an intermittent problem, which happens 99,9% of the time, but we've seen it working once in a while without problems.

    If you would list the tables used by the conversations module it would already help a lot.

    Thanks!

  • In reply to joao.prates:

    You are so far out of date with the product that there is zero % chance of getting support or bug fixes from Zimbra directly unless you upgrade to a newer version.  We may be able to help you diagnose the issue but I can't offer any more help than that.

  • In reply to Robert Nash:

    We are a very small (about 100 active users) community that some years ago saw Telligent just pulling back the free CS solution and left us out in the cold. It's nice to see now Zimbra coming back with a free platform again, and we might even consider a migration in the future, but in the immediate future that is not foreseen.

    I really don't expect any official support, as the product originally never had support anyway. I was just trying to see if some good soul with more inside knowledge here would be so kind as to give some hints on where to look for the problem. As you say, "help diagnose" the problem. I'll try to follow from there.

    Going back to the problem itself: We have a small SQL script that bans users meeting some criteria, and that is the only thing that changed more recently because the previous version was not working well. I am now suspecting that maybe that script is the culprit.

    Maybe the banning is not affecting all tables it should... it is a bit difficult to try to understand what a given action does when we don't have the code, and when the tables themselves don't have referential constraints between attributes. Having some attributes which are logically the same with different physical names on tables also does not help... so I do suspect the script is not working properly.

    Why this user ban is affecting only the private messages (aka conversations) is curious, but I'm sure there must be a logical explanation. :)

    Having seen that no table has any row with the columns you quoted with NULL, I'm now turning to a similar issue: Having a null/empty result set where at least one row was expected. I'll dig a bit more into it.

    Thanks for your help Robert.

  • In reply to joao.prates:

    Maybe you could try a SQL trace while the function is happening to see what tables and things it touches?

  • In reply to Rick Reszler:

    Hi Rick,

    I'm an Oracle DBA but my SQL Server knowledge is limited, and definitely  .Net development is way out of reach for me, so doing traces of SQL calls is a bit far stretched, but you do have a very valid point there.

    Perhaps it would be worth the trouble investigating how to do it so that my user ban script would be safer to run.

    Anyhow the problem remains: Even if I don't run the "unsafe" SQL script anymore, it seems damage has been made already, and I need to realize where it lies.

    If I knew how the conversations threads work, I could easily understand why the current CS code is getting nulls where it is expecting explicit values, and could correct the bad data as it stands now.

    In other words: It's getting obvious I need to correct the SQL script before running it again, but I can't just do that, I need to correct the damaged made by it as well.

    So back to square one: How to diagnose the problem now, i.e. why the conversations are not working...

    Thanks a lot guys, I've some work and some digging up to do already, but please do keep your ideas flowing!

    Cheers,

  • In reply to joao.prates:

    Thank you all, your hints were precious to me and did help out in the end!

    It turns out that I had some cs_UserProfile rows missing, i.e. not all cs_Users had a corresponding profile created, and this was what was causing all the problems.

    I used a fresh user profile as a template and created profile rows for all banned users, and sure as hell everything felt into place!

    Once again, thank you Rick and specially Robert for giving some clues to what was happening.

    In the end it was not a column that was being returned with an unexpected NULL value, it was an empty result set from the profiles.

    Cheers,

Related