aspose file tools*
The moose likes JForum and the fly likes Multiple email notifications for new messages in a forum topic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JForum
Bookmark "Multiple email notifications for new messages in a forum topic" Watch "Multiple email notifications for new messages in a forum topic" New topic
Author

Multiple email notifications for new messages in a forum topic

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hello there,

My company is using JForum (2.1.7) to provide customer support for our products.

One of our users is reporting that he is receiving 3-4 of the same notification emails every time a new message is posted in a forum topic he is watching.

I took a look at our JForum database, and noticed that in the jforum_topics_watch table, his user_id is associated with the same topic_id 3-4 times for all the topic_ids he is watching.

The odd thing is that other users, including myself, are not running into this problem.

Any idea of why this is happening and how we can fix it/prevent it from happening?
[originally posted on jforum.net by madjaguar]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
If your database supports it, you can define a Unique Index with both the User_Id and Topic_ID (or Forum_ID) fields.
This will prevent any double entries into the watch tables.

However, your user might see some nasty error messages if the code tries to do a double entry. (But this will also help find what's causing it...)
[originally posted on jforum.net by monroe]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Thanks for the reply!

I've just added the unique constraint, so we'll see what happens.

If we or our users start running into error messages, I'll post details here.
[originally posted on jforum.net by madjaguar]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi again,

Someone has reported an error when posting to the forum. I'm not 100% certain if it was caused by the newly added unique key constraint, but here's the stacktrace that they gave.



Let me know if you require further information.
[originally posted on jforum.net by madjaguar]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I don't think it's related unless the tool you used to update the tables has locked the DB somehow.

The underlying cause is that there is a pending transaction in the DB. In particular, the call being made is:

GenericUserDAO.incrementPosts

This is doing an Update to the jforum_users table and not any of the watch tables.

This could be a transient problem with some process just holding on to a lock at the wrong time for too long. Or it might indicate that somewhere some code is creating a deadlock situation. E.g., process X is waiting on Y who is waiting on Z who is waiting on X....


[originally posted on jforum.net by monroe]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi, I'm from the same place as madjaguar...

Thanks for your help so far; I think we're getting close to the answer.

I can see why you'd think from that stack trace that the database was locked, but that's not the case here. We're using PostgreSQL on the backend, and that error message means a previous statement within the current transaction has failed. In PostgreSQL, within a transaction, once a statement has failed, every subsequent statement until the next rollback will get that error.

I found the revelant information from the server log. Unfortunately, there is no stack trace for the initial error, which does appear to be due to the new unique constraint:


So the stack trace posted earlier (which I have snipped out here) is just fallout from the real problem, for which we don't have a stack trace.

Any ideas?

-Jonathan
[originally posted on jforum.net by jfuerth]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple email notifications for new messages in a forum topic