News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Unread Topics 'stopped' working

Started by @rjen, July 20, 2014, 03:50:37 PM

Previous topic - Next topic

@rjen

SMF version 2.0.8
Forum: www . fjr-club . nl

I have been running an SMF forum since 2011 and am very Happy with it. I have always been able to find solutions to 'problems' here, but now I have the first one I cannot resolve. I am completely baffled.

This problem started yesterday.

Let me explain: a long time ago I have adapted the forum to use the unread;all function instead of the standard unread.
No problem there: a user that selects "unread" fro  the menu gets presented the un read;all list.

As of yesterday something strange is happening:
when I read a new message from the unread;all list the item is no longer removed from the list after reading it.

When accessing the board the 'new' indicator is removed though, and also in a tinyportal block I am using the 'new'indicator is removed, but the topic still shows up in the unread list!
Now when I select the topic and perform the function: 'mark selected read' nothing changes: item still included in the list
Only if I now select the function "Mark all topics read" are the topics removed form the list!

Another symptom is, that when I post a new message myself, is is afterwards shown to me as unread as well!

I have (on the same server) a backup copy (month old) of the same forum running for testing purposes: this forum seems unaffected.

What have I done:
1. Checked all files for recent changes (hacking): none found
2. Checked the mods: no recent mod installed, and the backup forum is running fine with the same mods
3. Tried copying all source and theme files from the backup copy to the affected forum, no change in behaviour.
4. Repaired database, no changes

I suspect this has something to do with de database content, perhaps an incorrect update of tables smf_log_topics or smf_log_mark_read, but I cannot find any anomalies!!

If anyone can point me in the right direction to get this resolved I would be very grateful.

Just to be complete, these are the mods I am using (even though the test forum is using the same mods and does not suffer from these symptoms)

Add Social Media Icons To Profiles FJR   1.0.8
AJAX Recent Topics   1.1
Alternate User Posting   1.0.1
Auto Lock Old Topics   2.0
Custom Board Sort   1.0.2
Downloads System   2.1a
EU Cookie FJR   1.2fjr
Force Topic Read On Login Mod   2.1
Google Analytics Code   1.4
Group Attachment Limits   1.1.0
Ignore Topics   2.3
Optimus Brave   1.8.7
Order Custom Profile Fields   1.1.1
Previous and Next Links for Page Index   2.1.204
Simple Audio Video Embedder   2.3
SMF 2.0.8 Update   1.0
SMFPacks Shoutbox   1.0.4
Tapatalk SMF 2.0 Plugin   4.0.1
TinyPortal   1.107
Users Online Today   2.0.3
View Only Boards   1.2c
YandexGarland   1.2



Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Kindred

Is this happening for all users?
Is it happening on any access or, say,for example, only when connected via tapatalk?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

@rjen

This occurs only when connected directly (so not on tapatalk).

It seems most users suffer from the problem, but not all users: I have some 'test' users and one of those is not affected...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

margarett

That's something really odd.

When you read a topic it should mark it as read --> Display.php
if ($mark_at_msg >= $topicinfo['new_from'])
{
$smcFunc['db_insert']($topicinfo['new_from'] == 0 ? 'ignore' : 'replace',
'{db_prefix}log_topics',
array(
'id_member' => 'int', 'id_topic' => 'int', 'id_msg' => 'int',
),
array(
$user_info['id'], $topic, $mark_at_msg,
),
array('id_member', 'id_topic')
);
}

Of course, if $topicinfo['new_from'] is not correctly read in the first place, then things might go sour. But there is no reason for that to happen...
If a topic is in log_topics for a certain user, it will not show in unread topics. So you need to read an unread topic and check if it was recorded in the database.
It might be a tricky one to diagnose...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

@rjen

Further analysis:

The problem seems to only occur in using the unread;all function. The standard unread works as expected.
I cannot quite figure this out: how is the unread;all routine exactly different from the unread since last visit? Is it only timing of is there more?
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

margarett

Not exactly, no... If you search through the code of Recent.php, there are a number of differences based on $context['showing_all_topics'] (which is the ";all")

There is a number big number of cache-dependant operations due to performance penalties (and some tables eventually being locked in those operations)

Will that read topic *NEVER* go away from the unread list or will it disappear after a while? Can you empty your forum cache and try again?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

@rjen

In the meantime I am getting somewhere.

Going through the code of recent.php I found this:

Quote// !!! Add modified_time in for log_time check?

   if ($modSettings['totalMessages'] > 100000 && $context['showing_all_topics'])
   {
      $smcFunc['db_query']('', '
         DROP TABLE IF EXISTS {db_prefix}log_topics_unread',
         array(
         )
      );

If I understand this correctly the function will be behaving differently when the numer of messages read exceeds 100.000. Last week my forum has hit this 100.000 messages, and yes the backup forum I have is exactly below this number!
I setup a local copy of my forum for analysis, and when I deleted enough postst to get below the 100.000 number the unread;all resumed working as it is supposed to be!

Now looking for a solution (and don't suggest I keep throwing out messages to stay below 100K please).

1. Is it possible to affect the 100.000 treshold?
I can amend te code in recent.php, but is it there for a reason I assume

2. How am I supposed to use the unread;all function in a larger forum.
I seems that something is wrong leading to this situation....

Hopefully my question is getting more clearly defined now...

Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

I am still stuck with the incorrect behaviour of the Unread;all function when over 100.000 messages in the forum.

Does anyone have more information why the function in recent.php works incorrectly here? My php skills are insufficient to resolve this...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Arantor

That 100,000 threshold is simply about creating a temporary table to pre-sort results in.

This site has something like 3.5 million posts and it seems to work properly, so I'm really not sure where the problem might lie.

What happens if you disable Ignore Topics?

@rjen

Quote from: ‽ on July 23, 2014, 05:10:10 AM
That 100,000 threshold is simply about creating a temporary table to pre-sort results in.

This site has something like 3.5 million posts and it seems to work properly, so I'm really not sure where the problem might lie.

What happens if you disable Ignore Topics?

Darn, you're spot-on correct! Thanks for the suggestion!

I should have seen this myself: the amount of edits in recent.php by this Mod is large. Deinstalling it resolves the problem, re-installing it makes them come back...

Now let's see is I can get some alternative MOD, since it is being used in our forum...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Arantor

Maybe ask the mod author about it in its dedicated topic?

@rjen

Yup, I am right now scanning though that topic to see if this was already reported. Will follow up there (I see you have also done some work in that area  ;D )

Thanks for the help. Knowing where the issue originates makes mee sleep better at night...
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Arantor

Yeah, I knew it didn't do it on a basically clean version of SMF because if it did, it would have been noticed here a long time ago.

The thing about ignore topics is that it's a complex beast to get right and my attempts were not ideal but they did the job, albeit with some side effects. I know SMF 2.1 includes the function by default and handles it in a way that should make sense - but it's never been tested at any kind of scale as yet.

Advertisement: