File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JForum and the fly likes 4 Problems Interacting Simultaneously Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JForum
Bookmark "4 Problems Interacting Simultaneously" Watch "4 Problems Interacting Simultaneously" New topic
Author

4 Problems Interacting Simultaneously

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi Guys!

My JForum 2.1.7 CVS has 4 problems happening simultaneously:

1. When I sent an test e-mail it's not delivered and the following screen appears:

----------
Erro no envio do e-mail:

net.jforum.util.mail.EmailExceptioon: Could not connect to the mail server
----------

Now this problem is already resolved, but when the following problems could have be created it was not working properly...

2. The Users List page doesn't show all the users! It jumps the sequence: 2, 3, 4, 5, 6, 7, 11, 12!!!

Detail: the mail validation is set to true/yes! Considering that the mail server wasn't working properly, maybe the confirmation e-mails hadn't been sent (or received yet)...

3. The Newest registered user is information is showing the username from the user which ID is 7, not the last one that is 12.

4. The "Who is online" field which indicates how many users are online says that There are 7 registered users, when it should show 12!!!

Detail: looking the MySQL database, at the jforum_users table, is possible to discover the following important informations:

SELECT user_id , user_active , user_actkey
FROM jforum_users
WHERE user_id >=6


| user_id | user_active | user_actkey |
| 6 | 1 | NULL |
| 7 | 1 | NULL |
| 11 | NULL | 8b03... |
| 12 | NULL | f6a8... |
----------------------

Conclusions:

Given the above informations, I suppose the following:

A. The users 11 and 12 didn't activated their accounts via e-mail;
B. When one of these 2 newest users (11 and 12) activate their accounts, these one will in the same moment be the Newest registered user... it's because the user 7 is already shown as the last one registered.

Anyway, I have no idea why the users 8, 9 and 10 are hidden from the Users List AND from the jforum_users table!!!

Considering that the email activation is necessary to fully activate the account, why these users wasn't created in any place? It's the great question... because if it happens continuously, maybe some users could really try to register and give it up forever... :evil:

TKS for your attention and patience!!!

[ ]'s
[originally posted on jforum.net by leandro_salvador]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
New Discoveries:

There are 2 Tomcat's contexts running the same JForum's files and database structure, but accessed through different URLs.

One of them is a Test's context, while the other is the Production's...

There was one difference between them, about the above errors...

3. While Test showed the username from the user whick ID was 12, the Production showed the 7.

4. While the Test showed 9 new users, the Production showed 7 new users. The correct should be 12, but ok... 9 is more correct than 7!

The Production context is reseted everyday about +- 06:00 GMT. It happened a few minutes ago... and finally these 2 errors were corrected: now Test and Production contexts shows 9 new users and the username from 12.

Anyway, the 8, 9 and 10 users are still missing!!!

Would the new users informations just refreshes when Tomcat's context is restarted??? I have no idea why this difference, over the same files and the same database, but at different contexts, happened...

[ ]'s
[originally posted on jforum.net by leandro_salvador]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
leandro_salvador wrote:New Discoveries:

There are 2 Tomcat's contexts running the same JForum's files and database structure, but accessed through different URLs.

One of them is a Test's context, while the other is the Production's...
...


Are both JForum instances pointing to the same database? If so, I could see that causing problems (and lots of them!).
[originally posted on jforum.net by GatorBait3]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
GatorBait3 wrote:Are both JForum instances pointing to the same database? If so, I could see that causing problems (and lots of them!).


At really, this works like follows: first I test the JForum at Test context, if it works properly, I simply copy all the files and directories structure to the Production context.

It's the same files in the way of to have the same MD5, for example... but they are in different root directories... something like /public_html/test/ to the Test and /public_html/production/ to the Production.

The same database is a fact... at jforum-custom.conf both of them are pointed to the same database... it's not simply a copy and paste, but the same in fact...

What do you think about? Should it be the problem?

Now, the user 13 registered himself... his username appears at Users List, but the Who is Online doesn't refreshes yet: in other words, shows the 12 as the last one registered... and 9 as being the total of users... it should be 10 (or 13, when we discover where are the 8, 9 and 10) ;)

[ ]'s
[originally posted on jforum.net by leandro_salvador]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
leandro_salvador wrote:
GatorBait3 wrote:Are both JForum instances pointing to the same database? If so, I could see that causing problems (and lots of them!).


At really, this works like follows: first I test the JForum at Test context, if it works properly, I simply copy all the files and directories structure to the Production context.

It's the same files in the way of to have the same MD5, for example... but they are in different root directories... something like /public_html/test/ to the Test and /public_html/production/ to the Production.

The same database is a fact... at jforum-custom.conf both of them are pointed to the same database... it's not simply a copy and paste, but the same in fact...

What do you think about? Should it be the problem?

Now, the user 13 registered himself... his username appears at Users List, but the Who is Online doesn't refreshes yet: in other words, shows the 12 as the last one registered... and 9 as being the total of users... it should be 10 (or 13, when we discover where are the 8, 9 and 10) ;)

[ ]'s


Well, a lot of the potential for problems depends upon the underlying JForum code and how it tracks and handles inserts, deletes, etc. If anything is cached and the app is using the cached data, changing the DB with a different instance of JForum could cause problems (since the other JForum instance isn't using the same cached data)!

Imagine this scenario. You have 10 users in the database. You go into you test instance of JForum and add a couple of users. Then you hop over to your production Jforum and add a user there. Will it automatically pick up the users from the test instance? If the code is designed to check the database first to see what the current count is .. yes. If it is using cached data, maybe not .. since it didn't insert the two users, it may not know about them until it actually reads from the DB. Or, if any counters are persistent in memory, the numbers would not match between the two instances.

A good analogy would be like sharing a file between two computers. If two users both open the same file at the same time, make some changes to the file, and then saves the file back to the original location, who's changes end up in the file? Answer: the person that saved last. All the other person's changes would be lost! (assuming there is no file locking / management in place to prevent this from happening)

Rafael may be able to better answer this question regarding 2 instances of JForum connected to the same database.

But the potential for problems could be quite large.

A much safer practice would be to have a separate test database that the test JForum instance attaches to. That way you aren't "blending" your testing and production environments and data. This would provide a much lower risk of data corruption and loss, and you could do more thorough testing since you don't have to be careful about "contaminating" your production data with testing junk.

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

Joined: Apr 22, 2012
Posts: 17424
Dear GatorBait3...

Simple, objective and clean!
Perfectlly understood your point of view... 100% agreed!
Now I'm changing the database...

It's perfect when you say "don't have to be careful about "contaminating" your production data with testing junk"!!! It's exactly what happened!!!

When I was studying JForum, I crossed with some SQL query pre formatted which selected the last one user_id, but it's not prove that JForum uses it before to insert a new user...

Maybe Rafael could clear this point... :idea:

Anyway, TKS a LOT for your time and patience Buddy!

[ ]'s
[originally posted on jforum.net by leandro_salvador]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
You're welcome, and glad to help!
[originally posted on jforum.net by GatorBait3]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 4 Problems Interacting Simultaneously