PDA

View Full Version : Fatal error: Out of memory (allocated 786432) (tried to allocate 1966080 bytes)


coolcos
02-05-2010, 04:43 AM
I had posted this six days ago, with no response or acknowledgment. Therefore I am posting it here, hoping that and admin will finally see it.

Link to my post of six days ago: http://forum.unlimitedmb.com/showpost.php?p=19240&postcount=37


I have copied the message from that link to below:


"I am receiving the following error message upon occasion.

Fatal error: Out of memory (allocated 786432) (tried to allocate 1966080 bytes) in /hosted/subs/ulmb.com/i/q/iqnexus/public_html/myBB/member.php on line 1629


Update: we are also receiving the following errors in addition to the one stated above.

SQL Error:
1203 - User 13566_iqnexus already has more than 'max_user_connections' active connections
Query:
[READ] Unable to connect to MySQL server




Please help with these issues!


Thank you,

coolcos"

UnlimitedMB
02-05-2010, 05:00 AM
If you want us to reply post in the correct forum.
I don't get notification of new posts in feedback forum (its not for support questions), so it could be days before I come here.

The error is caused by your script using too much mysql queries.
Either the script is running too long, stuck in loop, or not closing open mysql connections.

coolcos
02-05-2010, 09:32 PM
Hello Eric,

Acknowledge about the posting in the correct forum.


However when I show your response to the MyBB admins and developers, they have this response.

MattRogowski
"...RE: MyBB SQL Error, using MyBB 1.4.11
It's not that it's running too many queries, it's because there are too many connections, they need to increase the max_user_connections setting. It's not stuck in a loop and as far as I'm aware all connections are closed. ..."

Can you please increase Max_user_connections setting?

Anything you can do to help would be appreciated.

Thank you,

Owen

Tyler
02-05-2010, 10:32 PM
If you search through the MyBB support forum they have tons of posts that come up when you search for "Too many connections" or max_user_connections. If you search through our forums you will see that you are one of only four or five customers who have ever reported a problem with too many MySQL connections. And those members are ones who created scripts that looped or left connections open (persistent connections).

This is definitely a problem with the MyBB script. The maximum number of connections you may have to the database at any one time is 10. This should not be a problem because connections are only open for a fraction of a second when the script is correctly coded. We cannot increase the limit because of a bulletin board system that is coded poorly, it will only keep getting worse and worse as you get more visitors until your account is suspended for abuse. There are many forums hosted on our servers with the same settings as your account (different forum software) that are much much larger, and have never run into this problem.

From your post on the MyBB boards, it appears that you recently upgraded the version of the script and ran into these problems. That should be a big red flag that it is a problem with the script.

If I may suggest, you may want to try using a forum like phpBB, or if you want to get a paid forum vBulletin or Invision Power Board.

coolcos
02-06-2010, 03:10 AM
If I take a quick look here at the documentation for MySQL on their website:

URL: http://dev.mysql.com/doc/refman/5.0/en/user-resources.html

reveals that the problem is more likely with your server setting in limiting connections.

Please take a look at the last paragraph as this is what I am experiencing.

"...5.5.4. Limiting Account Resources

One means of limiting use of MySQL server resources is to set the max_user_connections system variable to a nonzero value. However, this limits only the number of simultaneous connections made using a single account, and not what a client can do once connected. In addition, this method is strictly global, and does not allow for management of individual accounts. Both types of control are of interest to many MySQL administrators, particularly those working for Internet Service Providers.

In MySQL 5.0, you can limit the following server resources for individual accounts:

*

The number of queries that an account can issue per hour
*

The number of updates that an account can issue per hour
*

The number of times an account can connect to the server per hour
*

The number of simultaneous connections to the server an account can have (as of MySQL 5.0.3)

Any statement that a client can issue counts against the query limit. Only statements that modify databases or tables count against the update limit.

Before MySQL 5.0.3, an “account” in this context is assessed against the actual host from which a user connects. Suppose that there is a row in the user table that has User and Host values of usera and %.example.com, to allow usera to connect from any host in the example.com domain. If usera connects simultaneously from host1.example.com and host2.example.com, the server applies the account resource limits separately to each connection. If usera connects again from host1.example.com, the server applies the limits for that connection together with the existing connection from that host.

As of MySQL 5.0.3, an “account” corresponds to a single row in the user table. That is, connections are assessed against the User and Host value in the user table row that applies to the connection. In this case, the server applies resource limits collectively to all connections by usera from any host in the example.com domain because all such connections use the same account. The pre-5.0.3 method of accounting may be selected by starting the server with the --old-style-user-limits option.

The server limits account resources based on the resource-related columns of the user table in the mysql database: max_questions, max_updates, max_connections, and max_user_connections. If your user table does not have these columns, it must be upgraded; see Section 4.4.9, “mysql_upgrade — Check Tables for MySQL Upgrade”.

To set resource limits, use the GRANT statement and provide a WITH clause that names each resource to be limited. For example, to create a new account that can access the customer database, but only in a limited fashion, issue these statements:

mysql> CREATE USER 'francis'@'localhost' IDENTIFIED BY 'frank';
mysql> GRANT ALL ON customer.* TO 'francis'@'localhost'
-> WITH MAX_QUERIES_PER_HOUR 20
-> MAX_UPDATES_PER_HOUR 10
-> MAX_CONNECTIONS_PER_HOUR 5
-> MAX_USER_CONNECTIONS 2;

The limit types need not all be named in the WITH clause, but those named can be present in any order. The value for each per-hour limit should be an integer representing a count per hour. If the GRANT statement has no WITH clause, the limits are each set to the default value of zero (that is, no limit). For MAX_USER_CONNECTIONS, the limit is an integer representing the maximum number of simultaneous connections the account can make at any one time. If the limit is set to the default value of zero, the max_user_connections system variable determines the number of simultaneous connections for the account.

To modify limits for an existing account, use a GRANT USAGE statement at the global level (ON *.*). The following statement changes the query limit for francis to 100:

mysql> GRANT USAGE ON *.* TO 'francis'@'localhost'
-> WITH MAX_QUERIES_PER_HOUR 100;

This statement leaves the account's existing privileges unchanged and modifies only the limit values specified.

To remove an existing limit, set its value to zero. For example, to remove the limit on how many times per hour francis can connect, use this statement:

mysql> GRANT USAGE ON *.* TO 'francis'@'localhost'
-> WITH MAX_CONNECTIONS_PER_HOUR 0;

Resource-use counting takes place when any account has a nonzero limit placed on its use of any of the resources.

As the server runs, it counts the number of times each account uses resources. If an account reaches its limit on number of connections within the last hour, further connections for the account are rejected until that hour is up. Similarly, if the account reaches its limit on the number of queries or updates, further queries or updates are rejected until the hour is up. In all such cases, an appropriate error message is issued.

Resource counting is done per account, not per client. For example, if your account has a query limit of 50, you cannot increase your limit to 100 by making two simultaneous client connections to the server. Queries issued on both connections are counted together.

Queries for which results are served from the query cache do not count against the MAX_QUERIES_PER_HOUR limit.

The current per-hour resource-use counts can be reset globally for all accounts, or individually for a given account:

*

To reset the current counts to zero for all accounts, issue a FLUSH USER_RESOURCES statement. The counts also can be reset by reloading the grant tables (for example, with a FLUSH PRIVILEGES statement or a mysqladmin reload command).
*

The counts for an individual account can be set to zero by re-granting it any of its limits. To do this, use GRANT USAGE as described earlier and specify a limit value equal to the value that the account currently has.

Counter resets do not affect the MAX_USER_CONNECTIONS limit.

All counts begin at zero when the server starts; counts are not carried over through a restart.

For the MAX_USER_CONNECTIONS limit, an edge case can occur if the account currently has open the maximum number of connections allowed to it: A disconnect followed quickly by a connect can result in an error (ER_TOO_MANY_USER_CONNECTIONS or ER_USER_LIMIT_REACHED) if the server has not fully processed the disconnect by the time the connect occurs. When the server finishes disconnect processing, another connection will once more be allowed. ..."

Tyler
02-06-2010, 06:22 PM
That documentation says nothing about this being our problem. Actually, that last paragrpah that you claim is a problem with our server would be a problem with the script you are using. There is no reason why the script should disconnect and immediately reconnect (edge case). The script should just run all of their MySQL queries using the same one connection, then disconnect.

Again, this is not a problem with our servers, this is a problem with a poorly developed script. We have the limit set at 10 to prevent abuse to the server. This should be more than enough connections, even for large sites.

UnlimitedMB
02-07-2010, 05:31 PM
This problem was likely caused by another user who was abusing the server with high cpu usage and has been dealt with.

coolcos
02-13-2010, 05:57 AM
Please be aware that i have now canceled my account with ulmb.com

please make no attempt to charge me at the annual renewal time.


Coolcos