Nodejs + db-mysql Segmentation Fault - mysql

I don't know what causes it, but I have a Node app that keeps crashing. The console says Segmentation Fault, and it looks like it happens when two Mysql objects are instantiated (using db-mysql module), which becomes very common when 10+ users are using my site (I don't post the link to the app because I'm afraid the load would crash it ;) if it can be useful I'll post it).
Do you guys have any clue? My packages are up to date. Do you have a better package to use with Mysql (assuming it's where the problem lies)? Do you also encounter Segfault issues using Nodejs (I guess not, bcs stability is one of the main advantges of Node)?

I [think] I was definitely doing something wrong: cerating a new MySQL object and connecting to the DB every time I had a reaquest. Instead, I stored the MySQL object and run a single query for each... query. Working fine so far.

Related

No matter what I query, MySQLWorkbench gives me the same response

While I am just learning MySQL and MySQLWorkbench, and have perhaps have done something boneheaded, I cannot find a reference to this.
Suddenly, no matter what line of code or what query I run, it outputs the same response even if I query for tables disconnected to the response. The database tests connected. I have run the use command. I have tried to google hack this and found nothing close to my situation. It was running just fine. I did not change the database. I was just running some very basic SELECT queries.
Any ideas?
Did you check your installation ?

Sequel DB Connection PoolTimeout Error

I have been unable to determine what the cause of the following Sequel::PoolTimeout error is coming from in a Ruby script I have written:
Sequel::PoolTimeout: Sequel::PoolTimeout
hold at /Users/username/.rvm/gems/jruby-1.7.4#all/gems/sequel-4.2.0/lib/sequel/connection_pool/threaded.rb:100
hold at /Users/username/.rvm/gems/jruby-1.7.4#all/gems/sequel-4.2.0/lib/sequel/connection_pool/threaded.rb:93
synchronize at /Users/username/.rvm/gems/jruby-1.7.4#all/gems/sequel-4.2.0/lib/sequel/database/connecting.rb:234
execute at /Users/username/.rvm/gems/jruby-1.7.4#all/gems/sequel-4.2.0/lib/sequel/adapters/jdbc.rb:258
execute at /Users/username/.rvm/gems/jruby-1.7.4#all/gems/sequel-4.2.0/lib/sequel/dataset/actions.rb:793
fetch_rows at /Users/username/.rvm/gems/jruby-1.7.4#all/gems/sequel-4.2.0/lib/sequel/adapters/jdbc.rb:671
each at /Users/username/.rvm/gems/jruby-1.7.4#all/gems/sequel-4.2.0/lib/sequel/dataset/actions.rb:143
single_record at /Users/username/.rvm/gems/jruby-1.7.4#all/gems/sequel-4.2.0/lib/sequel/dataset/actions.rb:583
single_value at /Users/username/.rvm/gems/jruby-1.7.4#all/gems/sequel-4.2.0/lib/sequel/dataset/actions.rb:591
get at /Users/username/.rvm/gems/jruby-1.7.4#all/gems/sequel-4.2.0/lib/sequel/dataset/actions.rb:250
empty? at /Users/username/.rvm/gems/jruby-1.7.4#all/gems/sequel-4.2.0/lib/sequel/dataset/actions.rb:153
scrap at /Users/username/projectname/processers/get_category.rb:46
each at org/jruby/RubyArray.java:1617
each_with_index at org/jruby/RubyEnumerable.java:920
scrap at /Users/username/projectname/processers/get_category.rb:44
scrap at /Users/username/projectname/processers/get_category.rb:32
I have tried this with both MRI and JRuby with exactly the same results.
As per the instructions on the Sequel gem here, I have attempted to raise the pool_timeout limit as follows:
DB = Sequel.connect("jdbc:mysql://localhost/project_db?user=USERNAME&password=PASSWD&max_connections=10&pool_timeout=120")
It seems as though the max_connections and pool_timeout may not be recognized, however I'm not seeing any other way to pass these args on into the connection.
The actual code that is in question here is:
if DB[:products].where(url: url.to_s).empty?
I have seen the code work just fine for a little bit, but without fail it fails either right away or after a couple minutes without any reproducibility in terms of when it occurs. I am starting to suspect that this is a MySQL config issue or something causing the localhost DBMS to have some prolonged delays, although, again, I cannot manually reproduce a visible timeout that I can tell with manual queries, etc.
Any ideas on this issue as to why the timout would keep happening or, more particularly, how to resolve it either via feeding Sequel proper settings (perhaps I have a malformed arg list) or modifying MySQL's /etc/my.cnf for such a scenario?
The Sequel jdbc adapter passes the connection string directly to JDBC, it doesn't parse out embedded options. You need to do:
DB = Sequel.connect("jdbc:mysql://localhost/project_db?user=USERNAME&password=PASSWD", :max_connections=>10, :pool_timeout=>120)

Blackberry WebWorks HTML5 Database Issues

I've been having lots of problems getting my application to work using an sqlite database. Everything works just fine in ripple (I presume this is because it's just using chrome's sqlite implementation). However, once I run my app on a simulator (Curve 9300, OS 6) the problems begin. I've gotten to where the app can run, create a database, and insert rows, so I know that my actual queries are fine.
My application has a javascript file that has wrappers for working with the database. This javascript file is sourced in both the listener, and the page that is the core of the application. The problem is as follows:
Install the application. The listener starts running.
Send a text message from one simulator to another. The message is saved successfully (I can verify this because my banner indicator count increases, and the number is based of off a query)
Continue sending texts, and the banner indicator will increase.
Open the application, and read all of the messages. At this point, the javascript file is loaded twice, so I have two db objects pointing to the same database.
Close the application (listener is still running)
The next text message received causes a Runtime Exception, with no further details provided.
I looked at the stack trace, and it just says that the exception took place in the callback of the sms listener. This is obvious, as that's where the queries happen. Does anyone have any idea why opening a second connection to the db causes the exception? As far I understand, the db is only locked during a transaction. There are definitely no transactions running, other than the one trying to insert the new row. Although I'm new to javascript, I'm quite sure that no variables are being shared as the javascript file is loaded in two different pages. Any ideas would be greatly appreciated.
Well, I couldn't find a solution. I don't think the blackberry sqlite implementation can handle two concurrent connections. Instead, my listener now saves incoming data to a file. The file is read in when the main application opens, and all necessary data is saved to the db then. Afterwards, the file is deleted and the application performs queries without problem. I hope this helps anyone dealing with a similar issue.

Python3 MySQL Drivers

Recently, I switched to Python 3 (3.1 on a FreeBSD system), and i would like to work with MySQL databases.
First i tried to use pymysql3-0.4, but it failed when i used SUM in my query with this error:
, TypeError("Cannot convert b'46691486' to Decimal",))
Then i tried oursql-0.9.2, but it seems it has no unix socket support (the documentation write otherwise but it doesn't recognize the socket protocol.)
Last i decided to give a chance to mypysql-0.5.5 but the installation is failed.
Could you recommend me a properly working MySQL driver for Python 3, or at least solve one of these problems? I would be very greatfull.
The oursql documentation is a little tricky. :$ There is a list of Connection's parameters, but it doesn't contain the unix_socket parameter. If i set that and the the protocol parameter the whole thing is just work fine :)
If someone has trouble with inserting (get _statment charset AttributeError): https://bugs.launchpad.net/oursql/+bug/669184 change the lines in oursql.c with the code in the report, and rebuild it. (it will be fixed in 0.9.3)

MySQL User Defined Function to send a windows message

G'Day,
I want to use the Windows API Postmessage() call from inside a MySQL UDF on MySQL 5.1.51 (XP SP3). I know the UDF (Written in Delphi 2006) is working by setting a bogus result for the UDF.
The syntax of the UDF takes two integer params, one for a window handle and the other for a message number. However a call to PostMessage() from inside my UDF causes an exception in mysqld and the service stops.
Any ideas or pointers? Alternatively if anyone can tell me how I am able to simulate IB Events for MySQL via AnyDAC and Delphi OR an alternate approach to getting a notification when a record has changed in the database then please show me the light.
--Donovan
Your going to run into problems with this approach mainly due to the fact that messaging will only work to the same access level, and within the same session on the same computer. You would be better served by using other methods, such as TCPIP sockets, MailSlots, Memory mapped files, ect.
To best simulate a post message, I would use TCPIP UDP. A good lightweight library that I have used in the past is Synapse. The synapse library from SVN does run quite well against the latest versions of Delphi. The class you will want to use for this is the TUDPBlockSocket.
As an alternative to windows messages or TCP/IP, you might want to consider the named pipes answer to this question on sending information between two Delphi programs and this question on what named pipes are.
--jeroen
While I have had success via the UDF / Windows Pipe route I had another idea leveraging off being able to tap into the information message framework(?) in MySQL. See https://stackoverflow.com/q/3992779/223742