An issue when unixodbc dynamically linked with ltdl library? - mysql

all:
I am testing unixODBC in Solaris 10 environments, and find if libodbc and MyODBC driver are dynamically linked with libltdl.so:
ldd /usr/lib/libodbc.so.2
libltdl.so.7 => /usr/local/lib/libltdl.so.7
libiconv.so.2 => /usr/local/lib/libiconv.so.2
libthread.so.1 => /usr/lib/libthread.so.1
libc.so.1 => /usr/lib/libc.so.1
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1
libm.so.2 => /usr/lib/libm.so.2
/platform/SUNW,Sun-Fire-V240/lib/libc_psr.so.1
ldd /data/nan/mysql-connector-odbc-5.2.4-src/lib/libmyodbc5a.so
libodbc.so.2 => /usr/lib/libodbc.so.2
libthread.so.1 => /usr/lib/libthread.so.1
libm.so.2 => /usr/lib/libm.so.2
libodbcinst.so.2 => /usr/lib/libodbcinst.so.2
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1
libltdl.so.7 => /usr/local/lib/libltdl.so.7
libiconv.so.2 => /usr/local/lib/libiconv.so.2
libc.so.1 => /usr/lib/libc.so.1
/platform/SUNW,Sun-Fire-V240/lib/libc_psr.so.1
sometimes it will connect MySQL server failed when starting up application. The log likes this:
[ODBC][6738][1361325895.588941][SQLConnect.c][1111]Can't open lib '/data/nan/mysql-connector-odbc-5.2.4-src/lib/libmyodbc5a.so' : file not found
[ODBC][6738][1361325895.588979][SQLConnect.c][1111]Can't open lib '/data/nan/mysql-connector-odbc-5.2.4-src/lib/libmyodbc5a.so' : file not found
After a while, the application runs OK.
But if libodbc and MyODBC driver aren't dynamically linked with libltdl.so:
ldd /usr/local/lib/libodbc.so.2
libiconv.so.2 => /usr/local/lib/libiconv.so.2
libthread.so.1 => /usr/lib/libthread.so.1
libc.so.1 => /usr/lib/libc.so.1
libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1
libm.so.2 => /usr/lib/libm.so.2
/platform/SUNW,UltraAX-i2/lib/libc_psr.so.1
ldd /data1/susie/mysql/tools/test_static_modify/mysql-connector-odbc-5.2.3-src/lib/libmyodbc5a.so
libodbc.so.2 => /usr/local/lib/libodbc.so.2
libthread.so.1 => /usr/lib/libthread.so.1
libm.so.2 => /usr/lib/libm.so.2
libodbcinst.so.2 => /usr/local/lib/libodbcinst.so.2
libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1
libiconv.so.2 => /usr/local/lib/libiconv.so.2
libc.so.1 => /usr/lib/libc.so.1
/platform/SUNW,UltraAX-i2/lib/libc_psr.so.1
The application runs always OK..
So I think it may be a potential issue in unixODBC. Could anyone help to check it? Thanks very much in advance!
Best Regards
Nan Xiao

All unixODBC does is call dlopen and dlsym from libltdl, I wonder if there is some statics in the lib that is causing the problem. If you don't build unixODBC to use a exernal libltdl it uses its own version (from libtool), so again, it may be a conflict with them both hitting the same lib. You say you are using Solaris. Is the libltdl you are linking with from Sun?
What might be interesting is if you can get it to fail under truss so we could see just what the "file not found" is caused by.
I also wonder just what the MySQL driver uses libltdl for?

Related

Use of undefined constant SIGKILL - assumed 'SIGKILL' in Laravel 5.7 queue

I'm getting this error "Use of undefined constant SIGKILL - assumed 'SIGKILL'" from my AJAX request, that starts this artisan command ->
Artisan::call('queue:work', [
'connection' => 'database',
'--memory' => '700',
'--tries' => '1',
'--timeout' => '35000',
'--queue' => 'updates'
]);
I'm using Laravel 5.7 as framework for application.
Jobs are managed from database, configuration ->
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 18000,
],
Problem appeared recently.. That is weird, because troubles wasn't here before and all this "system" worked just fine. Now worker get some jobs done just fine, but then it drops to error, and writes to table "failed_jobs" in DB this ->
ErrorException: PDOStatement::execute(): MySQL server has gone away in /srv/migration-xxxxxx-xxxx-xxxxxx/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:458
As DB I'm using Microsoft Azure MySQL DB. Microsoft specialist after consultation find nothing .. server is working correctly. Queries are just fine, not that big to fail.
Please help, don't know what to do, or what is wrong...

Qt5 MYSQL driver not loaded error

I have a Fedora 27 64bit OS, and am trying to run a Qt based app which is trying to access a MySQL server (which I can successfully reach from the command line). But my app shows these errors:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
ERROR: DATABASE: Open failed with error code [-1]. Driver error [Driver not loaded]. Database error [Driver not loaded]
I've tried everything I could find online but can't solve this. When I check the libqsqlmysql.so dependencies I see:
[root#host lib64]# ldd /home/administrator/Qt/5.7/gcc_64/plugins/sqldrivers/libqsqlmysql.so
/home/administrator/Qt/5.7/gcc_64/plugins/sqldrivers/libqsqlmysql.so: /lib64/libmysqlclient_r.so.16: version `libmysqlclient_16' not found (required by /home/administrator/Qt/5.7/gcc_64/plugins/sqldrivers/libqsqlmysql.so)
linux-vdso.so.1 (0x00007fffde4ef000)
libmysqlclient_r.so.16 => /lib64/libmysqlclient_r.so.16 (0x00007f3188fd8000)
libz.so.1 => /lib64/libz.so.1 (0x00007f3188dc1000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f3188b8b000)
libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f3188971000)
libssl.so.10 => /lib64/libssl.so.10 (0x00007f3188705000)
libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007f31882a7000)
libQt5Sql.so.5 => /home/administrator/Qt/5.7/gcc_64/plugins/sqldrivers/../../lib/libQt5Sql.so.5 (0x00007f3188062000)
libQt5Core.so.5 => /home/administrator/Qt/5.7/gcc_64/plugins/sqldrivers/../../lib/libQt5Core.so.5 (0x00007f3187944000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f3187725000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f318739f000)
libm.so.6 => /lib64/libm.so.6 (0x00007f318704a000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f3186e33000)
libc.so.6 => /lib64/libc.so.6 (0x00007f3186a50000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f318684c000)
libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007f31865e0000)
libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007f3186158000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007f3185f55000)
libicui18n.so.56 => /home/administrator/Qt/5.7/gcc_64/plugins/sqldrivers/../../lib/libicui18n.so.56 (0x00007f3185abb000)
libicuuc.so.56 => /home/administrator/Qt/5.7/gcc_64/plugins/sqldrivers/../../lib/libicuuc.so.56 (0x00007f3185703000)
libicudata.so.56 => /home/administrator/Qt/5.7/gcc_64/plugins/sqldrivers/../../lib/libicudata.so.56 (0x00007f3183d20000)
libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007f3183b1e000)
librt.so.1 => /lib64/librt.so.1 (0x00007f3183916000)
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f3183602000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3189440000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f318338f000)
and sure enough there is no /lib64/libmysqlclient_r.so.16 on my system. And DNF says that nothing provides this file! So I tried to symlink /lib64/libmysqlclient_r.so to /lib64/libmysqlclient_r.so.16 but still no joy.
Can someone offer a solution?
After lots of searching on different sites, the consensus was to recompile the Qt sql drivers from source (which is installed with Qt Creator). Switch to the source directory for SQL drivers then 'make', and 'make install'
After that the error was gone.
Ignore all the suggestions about copying/symlinking different .so files. It doesn't work (anymore).

How to configure yii2-solr extension

I want to use yii2-solr extension in one of my projects. How can I configure this extension. Nothing is mentioned on the extension page. Has anyone used this extension? Any help would be appreciable. Thank you.
I found the extension on github repo . In readme file it is mention to configure it as follows:
'solr' => [
'class' => 'sammaye\solr\Client',
'options' => [
'endpoint' => [
'solr1' => [
'host' => '10.208.225.66',
'port' => '8983',
'path' => '/solr'
]
]
]
],
But after doing all this I am getting the following error:
Class 'Solarium\Client' not found
In one of its Client.php file the line is:
use Solarium\Client as SolrClient;
I checked all the files but Solarium namespace is not there.
yii2-solr depends on the Solarium library. If you installed yii2-solr via composer, it should have automatically downloaded it as dependency. Check github composer.json. If not, you'll have to install it manually, see packagist.

Laravel failing to connect to DB after 4.2 upgrade

I just upgraded my Laravel install from 4.1.(something) to 4.2.7 using the steps recommended here: http://laravel.com/docs/upgrade
Now I'm getting this error on every page:
PDOException (2002)
SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '' (111)
MySQL is not running locally, but it's not supposed to be. I don't have any configuration for connecting to local MySQL, my development SQL server is remote. Why is it trying to connect to local?
Is there some config change that isn't mentioned in the upgrade guide? Everything was peachy in 4.1.
From my app/config/database.php file:
'default' => 'mysql',
...
'connections' => array(
'mysql' => array(
'driver' => 'mysql',
'host' => 'myrealdb.us-east-1.rds.amazonaws.com',
'database' => 'myrealdbname',
'username' => 'myrealuser',
'password' => 'myrealpass',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'database_port' => '3306',
'unix_socket' => '',
),
...
);
I tried php artisan clear-compiled and php artisan dump-autoload just in case. No effect.
Edit: I submitted a fix for this that has been merged into the 4.2 branch. You shouldn't have to worry about this error anymore.
I got it! This appears to be a change in the way Laravel uses the database configuration, I hope this answer helps others.
The short version is: if your connection is configured like mine (in the question), delete the unix_socket entry from the array.
Previously, I always copied and edited the default entries in the connections array, leaving in the unix_socket parameter as empty. Apparently now there's a check that assumes if unix_socket is present, it should use a socket DSN string. The empty string in my config passed the check. You can see how this happens in /vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php. The functions getDsn, getSocketDsn, and getHostDsn tell the story.
Pasted because this will eventually change:
protected function getDsn(array $config)
{
return isset($config['unix_socket']) ? $this->getSocketDsn($config) : $this->getHostDsn($config);
}
...
protected function getSocketDsn(array $config)
{
extract($config);
return "mysql:unix_socket={$config['unix_socket']};dbname={$database}";
}
...
protected function getHostDsn(array $config)
{
extract($config);
return isset($config['port'])
? "mysql:host={$host};port={$port};dbname={$database}"
: "mysql:host={$host};dbname={$database}";
}

exception_notification: smtp not working

I am using Rails 3.2.5 and exception_notification gem. In production mode, I am generally sending emails using PostMarkApp's postmark-rails gem.
Initially, I got a View error from exception_notification gem stating
ActionView::Template::Error (code converter not found (UTF-8 to UTF-16))
so based on exception_notification gem raises ActionView::Template::Error (code converter not found (UTF-8 to UTF-16)) only on Heroku production mode, I moved to
gem 'exception_notification', git: 'git://github.com/alanjds/exception_notification.git'
This solved that bug. Now, I want the gem to send emails from my gmail account instead of using PostMarkApp credits, so I added the following to my production.rb, yet Exception Notification attempts to send email only from Post Mark App. Why is this setting not working?
config.middleware.use ExceptionNotifier,
sender_address: 'noreply#mydomain.com',
exception_recipients: 'myemail#mydomain.com',
sections: %w{current_user} + ExceptionNotifier::Notifier.default_sections,
ignore_crawlers: %w{Googlebot bingbot},
email_format: true,
normalize_subject: true,
smtp_settings: {
:address => "smtp.gmail.com",
:port => "587",
:domain => "www.gmail.com",
:user_name => "myemail#gmail.com",
:password => "mypassword",
:authentication => "plain",
:enable_starttls_auto => true,
:openssl_verify_mode => 'none'
}
config.action_mailer.delivery_method = :postmark
config.action_mailer.postmark_settings = { :api_key => "_____" }
For some reason it appears that SMTP delivery does NOT work in the development environment. I tried a number of different settings and was never able to get this to work. It DOES however work in my other environments. Older posts seem to indicate this as well:
http://www.ruby-forum.com/topic/64776
http://www.devchix.com/2008/12/09/how-to-see-exception_notification-plugin-work-in-development-mode/
In development, I am using the following in my development.rb:
config.action_mailer.delivery_method = :letter_opener
config.middleware.use ExceptionNotifier,
:sender_address => 'test#test.com',
:exception_recipients => 'recipient#test.com'
In my "staging" environment, I am using the following in my staging.rb:
config.action_mailer.delivery_method = :smtp
config.middleware.use ExceptionNotifier,
:sender_address => 'test#test.com',
:exception_recipients => 'recipient#test.com'
The staging.rb acquires it's SMTP settings from an initializer I have the uses SendGrid for SMTP:
ActionMailer::Base.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => 25,
:domain => "test.com",
:user_name => "user_name",
:password => "password",
:authentication => "plain"
}
Try the suggestion at http://www.scottw.com/multiple-smtp-servers-with-action-mailer
or at Rails ActionMailer with multiple SMTP servers