pat / thinking-sphinx

Sphinx/Manticore plugin for ActiveRecord/Rails
http://freelancing-gods.com/thinking-sphinx
MIT License
1.63k stars 469 forks source link

Address family not supported by protocol - socket(2) #273

Closed awijeet closed 13 years ago

awijeet commented 13 years ago

I have working code of search... but 10 times in 100 attempts.. the search yields the error message as " Address family not supported by protocol - socket(2)". and I am stumped. Thanks and Regards. Awijeet Shandilya

pat commented 13 years ago

I've not seen that message before... Awijeet, which versions of Rails, Thinking Sphinx and Sphinx are you using? Can you also share the searchd section of the configuration file? (Located in config, named like RAILS_ENV.sphinx.conf).

And is this happening in development, or production, or both?

awijeet commented 13 years ago

Rails 2.3.11 rake thinking_sphinx:version (in /data/loc/releases/20110824064303) Thinking Sphinx v1.4.6 Thinking Sphinx v1.4.6

and sphinx.yml development: &base_settings max_matches: 10000

staging: <<: *base_settings bin_path: '/usr/bin/' searchd_file_path: '/data/loc/shared/sphinx'

production: <<: *base_settings bin_path: '/usr/bin/' searchd_file_path: '/data/loc/shared/sphinx'

awijeet commented 13 years ago

and production.sphinx.conf is as ..

indexer { mem_limit = 64 }

searchd { address = localhost port = 9312 log = /var/log/engineyard/sphinx/loc/searchd.log query_log = /var/log/engineyard/sphinx/loc/query.log pid_file = /var/run/sphinx/loc.pid max_matches = 10000 }

source college_core_0 { type = mysql sql_host = ec2----**.compute-1.amazonaws.com sql_user = * sql_pass = ** sql_db = loc sql_query_pre = SET NAMES utf8 sql_query_pre = SET TIME_ZONE = '+0:00' sql_query = SELECT SQL_NO_CACHE colleges.id * 4 + 0 AS id , colleges.name AS name, colleges.subdomain AS subdomain, countries.name AS country_name, colleges.id AS sphinx_internal_id, 1701297822 AS class_crc, 0 AS sphinx_deleted FROM colleges LEFT OUTER JOIN countries ON countries.id = colleges.country_id WHERE colleges.id >= $start AND colleges.id <= $end GROUP BY colleges.id ORDER BY NULL sql_query_range = SELECT IFNULL(MIN(id), 1), IFNULL(MAX(id), 1) FROM colleges sql_attr_uint = sphinx_internal_id sql_attr_uint = class_crc sql_attr_uint = sphinx_deleted sql_query_info = SELECT * FROM colleges WHERE id = (($id - 0) / 4) }

index college_core { source = college_core_0 path = /var/log/engineyard/sphinx/loc/indexes/college_core charset_type = utf-8 min_prefix_len = 2 enable_star = 1 }

index college { type = distributed local = college_core }

source post_core_0 { type = mysql sql_host = ec2----**.compute-1.amazonaws.com sql_user = deploy sql_pass = ** sql_db = loc sql_query_pre = UPDATE posts SET delta = 0 WHERE delta = 1 sql_query_pre = SET NAMES utf8 sql_query_pre = SET TIME_ZONE = '+0:00' sql_query = SELECT SQL_NO_CACHE posts.id * 4 + 1 AS id , posts.raw_post AS raw_post, posts.body AS body, posts.title AS title, posts.contribution_tags AS contribution_tags, posts.id AS sphinx_internal_id, 4206412723 AS class_crc, 0 AS sphinx_deleted, IFNULL(posts.title, '') AS title_sort, id AS id, posts.category_id AS category_id, UNIX_TIMESTAMP(posts.published_at) AS published_at, posts.view_count AS view_count, posts.share_count AS share_count, posts.like_count AS like_count, posts.popularity_index AS popularity_index, posts.comments_count AS comments_count, posts.api AS api FROM posts WHERE posts.id >= $start AND posts.id <= $end AND posts.delta = 0 GROUP BY posts.id ORDER BY NULL sql_query_range = SELECT IFNULL(MIN(id), 1), IFNULL(MAX(id), 1) FROM posts WHERE posts.delta = 0 sql_attr_uint = sphinx_internal_id sql_attr_uint = class_crc sql_attr_uint = sphinx_deleted sql_attr_uint = id sql_attr_uint = category_id sql_attr_uint = view_count sql_attr_uint = share_count sql_attr_uint = like_count sql_attr_uint = popularity_index sql_attr_uint = comments_count sql_attr_bool = api sql_attr_timestamp = published_at sql_attr_str2ordinal = title_sort sql_query_info = SELECT * FROM posts WHERE id = (($id - 1) / 4) }

index post_core { source = post_core_0 path = /var/log/engineyard/sphinx/loc/indexes/post_core charset_type = utf-8 min_prefix_len = 2 enable_star = 1 }

source post_delta_0 : post_core_0 { type = mysql sql_host = ec2----**.compute-1.amazonaws.com sql_user = deploy sql_pass = ** sql_db = loc sql_query_pre = sql_query_pre = SET NAMES utf8 sql_query_pre = SET TIME_ZONE = '+0:00' sql_query = SELECT SQL_NO_CACHE posts.id * 4 + 1 AS id , posts.raw_post AS raw_post, posts.body AS body, posts.title AS title, posts.contribution_tags AS contribution_tags, posts.id AS sphinx_internal_id, 4206412723 AS class_crc, 0 AS sphinx_deleted, IFNULL(posts.title, '') AS title_sort, id AS id, posts.category_id AS category_id, UNIX_TIMESTAMP(posts.published_at) AS published_at, posts.view_count AS view_count, posts.share_count AS share_count, posts.like_count AS like_count, posts.popularity_index AS popularity_index, posts.comments_count AS comments_count, posts.api AS api FROM posts WHERE posts.id >= $start AND posts.id <= $end AND posts.delta = 1 GROUP BY posts.id ORDER BY NULL sql_query_range = SELECT IFNULL(MIN(id), 1), IFNULL(MAX(id), 1) FROM posts WHERE posts.delta = 1 sql_attr_uint = sphinx_internal_id sql_attr_uint = class_crc sql_attr_uint = sphinx_deleted sql_attr_uint = id sql_attr_uint = category_id sql_attr_uint = view_count sql_attr_uint = share_count sql_attr_uint = like_count sql_attr_uint = popularity_index sql_attr_uint = comments_count sql_attr_bool = api sql_attr_timestamp = published_at sql_attr_str2ordinal = title_sort sql_query_info = SELECT * FROM posts WHERE id = (($id - 1) / 4) }

index post_delta : post_core { source = post_delta_0 path = /var/log/engineyard/sphinx/loc/indexes/post_delta }

index post { type = distributed local = post_delta local = post_core }

source suggest_wire_core_0 { type = mysql sql_host = ec2----**.compute-1.amazonaws.com sql_user = deploy sql_pass = ** sql_db = loc sql_query_pre = UPDATE suggest_wires SET delta = 0 WHERE delta = 1 sql_query_pre = SET NAMES utf8 sql_query_pre = SET TIME_ZONE = '+0:00' sql_query = SELECT SQL_NO_CACHE suggest_wires.id * 4 + 2 AS id , suggest_wires.name AS name, countries.name AS country_name, suggest_wires.id AS sphinx_internal_id, 300946159 AS class_crc, 0 AS sphinx_deleted, suggest_wires.approved AS approved, suggest_wires.converted AS converted FROM suggest_wires LEFT OUTER JOIN countries ON countries.id = suggest_wires.country_id WHERE suggest_wires.id >= $start AND suggest_wires.id <= $end AND suggest_wires.delta = 0 GROUP BY suggest_wires.id ORDER BY NULL sql_query_range = SELECT IFNULL(MIN(id), 1), IFNULL(MAX(id), 1) FROM suggest_wires WHERE suggest_wires.delta = 0 sql_attr_uint = sphinx_internal_id sql_attr_uint = class_crc sql_attr_uint = sphinx_deleted sql_attr_bool = approved sql_attr_bool = converted sql_query_info = SELECT * FROM suggest_wires WHERE id = (($id - 2) / 4) }

index suggest_wire_core { source = suggest_wire_core_0 path = /var/log/engineyard/sphinx/loc/indexes/suggest_wire_core charset_type = utf-8 min_prefix_len = 2 enable_star = 1 }

source suggest_wire_delta_0 : suggest_wire_core_0 { type = mysql sql_host = ec2----**.compute-1.amazonaws.com sql_user = deploy sql_pass = ** sql_db = loc sql_query_pre = sql_query_pre = SET NAMES utf8 sql_query_pre = SET TIME_ZONE = '+0:00' sql_query = SELECT SQL_NO_CACHE suggest_wires.id * 4 + 2 AS id , suggest_wires.name AS name, countries.name AS country_name, suggest_wires.id AS sphinx_internal_id, 300946159 AS class_crc, 0 AS sphinx_deleted, suggest_wires.approved AS approved, suggest_wires.converted AS converted FROM suggest_wires LEFT OUTER JOIN countries ON countries.id = suggest_wires.country_id WHERE suggest_wires.id >= $start AND suggest_wires.id <= $end AND suggest_wires.delta = 1 GROUP BY suggest_wires.id ORDER BY NULL sql_query_range = SELECT IFNULL(MIN(id), 1), IFNULL(MAX(id), 1) FROM suggest_wires WHERE suggest_wires.delta = 1 sql_attr_uint = sphinx_internal_id sql_attr_uint = class_crc sql_attr_uint = sphinx_deleted sql_attr_bool = approved sql_attr_bool = converted sql_query_info = SELECT * FROM suggest_wires WHERE id = (($id - 2) / 4) }

index suggest_wire_delta : suggest_wire_core { source = suggest_wire_delta_0 path = /var/log/engineyard/sphinx/loc/indexes/suggest_wire_delta }

index suggest_wire { type = distributed local = suggest_wire_delta local = suggest_wire_core }

source user_core_0 { type = mysql sql_host = ec2----**.compute-1.amazonaws.com sql_user = deploy sql_pass = ** sql_db = loc sql_query_pre = UPDATE users SET delta = 0 WHERE delta = 1 sql_query_pre = SET NAMES utf8 sql_query_pre = SET TIME_ZONE = '+0:00' sql_query = SELECT SQL_NO_CACHE users.id * 4 + 3 AS id , users.name AS name, users.description AS description, colleges.name AS college_name, colleges.subdomain AS college_subdomain, users.country_name AS country_name, users.id AS sphinx_internal_id, 765557111 AS class_crc, 0 AS sphinx_deleted, users.privacy_level AS privacy_level, users.featured_contributor AS featured_contributor, users.suspended AS suspended, users.topical AS topical, users.topical_all AS topical_all, users.role_id AS role_id, users.points AS points FROM users LEFT OUTER JOIN colleges ON colleges.id = users.college_id WHERE users.id >= $start AND users.id <= $end AND users.delta = 0 AND privacy_level != 0 GROUP BY users.id ORDER BY NULL sql_query_range = SELECT IFNULL(MIN(id), 1), IFNULL(MAX(id), 1) FROM users WHERE users.delta = 0 sql_attr_uint = sphinx_internal_id sql_attr_uint = class_crc sql_attr_uint = sphinx_deleted sql_attr_uint = privacy_level sql_attr_uint = role_id sql_attr_uint = points sql_attr_bool = featured_contributor sql_attr_bool = suspended sql_attr_bool = topical sql_attr_bool = topical_all sql_query_info = SELECT * FROM users WHERE id = (($id - 3) / 4) }

index user_core { source = user_core_0 path = /var/log/engineyard/sphinx/loc/indexes/user_core charset_type = utf-8 min_prefix_len = 2 enable_star = 1 }

source user_delta_0 : user_core_0 { type = mysql sql_host = ec2----**.compute-1.amazonaws.com sql_user = deploy sql_pass = ** sql_db = loc sql_query_pre = sql_query_pre = SET NAMES utf8 sql_query_pre = SET TIME_ZONE = '+0:00' sql_query = SELECT SQL_NO_CACHE users.id * 4 + 3 AS id , users.name AS name, users.description AS description, colleges.name AS college_name, colleges.subdomain AS college_subdomain, users.country_name AS country_name, users.id AS sphinx_internal_id, 765557111 AS class_crc, 0 AS sphinx_deleted, users.privacy_level AS privacy_level, users.featured_contributor AS featured_contributor, users.suspended AS suspended, users.topical AS topical, users.topical_all AS topical_all, users.role_id AS role_id, users.points AS points FROM users LEFT OUTER JOIN colleges ON colleges.id = users.college_id WHERE users.id >= $start AND users.id <= $end AND users.delta = 1 AND privacy_level != 0 GROUP BY users.id ORDER BY NULL sql_query_range = SELECT IFNULL(MIN(id), 1), IFNULL(MAX(id), 1) FROM users WHERE users.delta = 1 sql_attr_uint = sphinx_internal_id sql_attr_uint = class_crc sql_attr_uint = sphinx_deleted sql_attr_uint = privacy_level sql_attr_uint = role_id sql_attr_uint = points sql_attr_bool = featured_contributor sql_attr_bool = suspended sql_attr_bool = topical sql_attr_bool = topical_all sql_query_info = SELECT * FROM users WHERE id = (($id - 3) / 4) }

index user_delta : user_core { source = user_delta_0 path = /var/log/engineyard/sphinx/loc/indexes/user_delta }

index user { type = distributed local = user_delta local = user_core }

awijeet commented 13 years ago

If i perform the User.search("Afghanistan") at console it always yields result, but when do the same with web apps.. it fails sometimes... you can check things here... http://liveoncampus.com/find click on any eye and if it gives you yielded "0 results", then refresh the page and you will get the result..

awijeet commented 13 years ago

Thanks freelancing-god, for your interest and concern. As far the development on this issue is concern "I can tell you that this error is coming because of * can't activate , already activated thinking-sphinx-2.0.5*** " and it's also not persistent error, some times it comes and some time search works. Please suggest me how to resolve this.

Thanks Awijeet

pat commented 13 years ago

Hi Awijeet - How are you specifying the dependency on Thinking Sphinx in either your Gemfile or environment.rb?

awijeet commented 13 years ago

environement.rb

RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION require File.join(File.dirname(FILE), 'boot')

Rails::Initializer.run do |config| config.gem 'thinking-sphinx', :lib => 'thinking_sphinx', :version => '1.4.0'

pat commented 13 years ago

Sounds like you've got TS 2.0.5 installed as well - are you using that for any other projects? Perhaps try uninstalling that and see if that helps?

Also, it's worth updating TS to use the latest 1.4 release - which is currently 1.4.6.

awijeet commented 13 years ago

Thanks for help. Freelancing-god. It was fault of installation, as two version of TS was install :P. Now it's fixed. Thank you very much.

pat commented 13 years ago

Ah great :)