require 'faker'
require 'async'
require 'newrelic_rpm'
NewRelic::Agent.manual_start
class Movie
attr_reader :attributes
def initialize(attributes={})
#attributes = attributes
end
def to_hash
#attributes
end
end
require 'elasticsearch/persistence'
require 'elasticsearch'
class MyRepository; include Elasticsearch::Persistence::Repository; end
client = Elasticsearch::Client.new(url: 'http://localhost:9200', request_timeout: 5*60, retry_on_failure: true)
repository = MyRepository.new(client: client)
def indexit(repository)
Async do
movie = Movie.new(title: Faker::Movie.title)
repository.save(movie)
p "indexed #{Time.now}..."
end
end
Async do
250.times do
indexit(repository)
end
end
It runs successfully if we run the loop 240 times but the moment we increase loop times to 250 most of the requests are indexing data but a few requests are failing and show follow error:
| → /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/net/http.rb:987 in `initialize'
| /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/net/http.rb:987 in `open'
| /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/net/http.rb:987 in `block in connect'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/timeout-0.3.0/lib/timeout.rb:179 in `block in timeout'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/timeout-0.3.0/lib/timeout.rb:186 in `timeout'
| /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/net/http.rb:985 in `connect'
| /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/net/http.rb:970 in `do_start'
| /Users/sivagollapalli/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/net/http.rb:959 in `start'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/faraday-net_http-1.0.1/lib/faraday/adapter/net_http.rb:146 in `request_via_request_method'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/faraday-net_http-1.0.1/lib/faraday/adapter/net_http.rb:131 in `request_with_wrapped_block'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/faraday-net_http-1.0.1/lib/faraday/adapter/net_http.rb:122 in `perform_request'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/faraday-net_http-1.0.1/lib/faraday/adapter/net_http.rb:66 in `block in call'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/faraday-1.10.0/lib/faraday/adapter.rb:50 in `connection'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/faraday-net_http-1.0.1/lib/faraday/adapter/net_http.rb:64 in `call'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/faraday-1.10.0/lib/faraday/rack_builder.rb:154 in `build_response'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/faraday-1.10.0/lib/faraday/connection.rb:516 in `run_request'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/elasticsearch-transport-7.9.0/lib/elasticsearch/transport/transport/http/faraday.rb:40 in `block in perform_request'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/elasticsearch-transport-7.9.0/lib/elasticsearch/transport/transport/base.rb:288 in `perform_request'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/elasticsearch-transport-7.9.0/lib/elasticsearch/transport/transport/http/faraday.rb:37 in `perform_request'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/elasticsearch-transport-7.9.0/lib/elasticsearch/transport/client.rb:176 in `perform_request'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/elasticsearch-api-7.9.0/lib/elasticsearch/api/actions/index.rb:73 in `index'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/elasticsearch-persistence-7.2.1/lib/elasticsearch/persistence/repository/store.rb:44 in `save'
| async_persistance.rb:29 in `block in indexit'
| /Users/sivagollapalli/.rvm/gems/ruby-3.0.0/gems/async-1.30.3/lib/async/task.rb:261 in `block in make_fiber'
I am using elastic search 7.10.1 with docker. I suspect this could be an issue of thread pools of elastic search but I am not sure.
I have Ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux] and when I'm trying to use Wordmove, I'm getting following pull error:
▬▬ ✓ Pulling Database ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
local | mysqldump --host=localhost --user=USER --password=PASS wpDB > /var/www/local/wp-content/local-backup-1421774302.sql
remote | mysqldump --host=localhost --user=USER --password=PASS wpDB > /var/www/site/wp-content/dump.sql
remote | get: /var/www/site/wp-content/dump.sql /var/www/local/wp-content/dump.sql
remote | delete: /var/www/site/wp-content/dump.sql
local | adapt dump
/var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/sql_adapter.rb:44:in `gsub!': invalid byte sequence in UTF-8 (ArgumentError)
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/sql_adapter.rb:44:in `serialized_replace!'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/sql_adapter.rb:36:in `replace_field!'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/sql_adapter.rb:25:in `replace_vhost!'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/sql_adapter.rb:17:in `adapt!'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/deployer/base.rb:182:in `adapt_sql'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/deployer/ssh.rb:35:in `pull_db'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:47:in `block in pull'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:34:in `block in handle_options'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:32:in `each'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:32:in `handle_options'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/lib/wordmove/cli.rb:46:in `pull'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /var/lib/gems/1.9.1/gems/wordmove-1.2.0/bin/wordmove:6:in `<top (required)>'
from /usr/local/bin/wordmove:23:in `load'
from /usr/local/bin/wordmove:23:in `<main>'
Other websites run in the very same environment does not show this error. Does anyone have any idea, what can be casuing this error?
Add
sql_content.encode!('UTF-16', 'UTF-8', :invalid => :replace, :replace => '')
sql_content.encode!('UTF-8', 'UTF-16')
sql_content.force_encoding("UTF-8")
to this File,above the line 45
/root/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/wordmove-2.1.2/lib/wordmove/sql_adapter/default.rb
or this File
/var/lib/gems/2.7.0/gems/wordmove-5.2.2/lib/wordmove/sql_adapter/default.rb
Ref: https://github.com/welaika/wordmove/wiki/invalid-byte-sequence-in-UTF-8-while-pushing---pulling-db
I'm trying to execute the following command on my Heroku app:
heroku db:push postgres://username:password#localhost:5432/db_name
I successful used the same command a lot of times in the past three months but today it stopped working. It seems like it stopped working as soon as it reached 5MB in size (now it's about 8MB big). The thing is that I now started paying for the shared database so I should be allowed to have 20GB space.
This is the command output:
> heroku db:push postgres://username:password#localhost:5432/db_name --account java
Loaded Taps v0.3.23
Warning: Data in the app 'my-test-app' will be overwritten and will not be recoverable.
! WARNING: Potentially Destructive Action
! This command will affect the app: my-test-app
! To proceed, type "my-test-app" or re-run this command with --confirm my-test-app
> my-test-app
Sending schema
Schema: 100% |==========================================| Time: 00:00:46
Sending indexes
test_gift_rec: 100% |==========================================| Time: 00:00:01
test_person: 100% |==========================================| Time: 00:00:01
Sending data
14 tables, 114 records
test_bonus_aw: 100% |==========================================| Time: 00:00:00
test_money_tr: 100% |==========================================| Time: 00:00:00
test_friendsh: 100% |==========================================| Time: 00:00:00
test_friendsh: 100% |==========================================| Time: 00:00:00
test_gift_rec: 100% |==========================================| Time: 00:00:00
test_group: 100% |==========================================| Time: 00:00:00
test_country: 100% |==========================================| Time: 00:00:00
test_user_is_: 100% |==========================================| Time: 00:00:00
test_gift: 100% |==========================================| Time: 00:00:00
test_user_has: 0% | | ETA: --:--:--
Saving session to push_201204301144.dat..
!!! Caught Server Exception
HTTP CODE: 500
Taps Server Error: undefined method `symbolize_keys' for nil:NilClass
["/app/lib/taps/data_stream.rb:183:in `parse_json'", "/app/lib/taps/server.rb:89:in `block in <class:Server>'","/app/.bundle/gems/ruby/1.9.1/gems/satra-1.0/lib/sinatra/base.rb:865:in `call'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra1.0/lib/sinatra/base.rb:865:in `block in route'", "/app/.bune/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:521:in `instance_eval'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:5:in `route_eval'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:500:in `block (2 levels) in route!'", "/app/.bundle/gems/ruby/9.1/gems/sinatra-1.0/lib/sinatra/base.rb:497:in `catch'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:497:in `block in route!, "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:476:in `each'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/baseb:476:in `route!'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:601:in `dispatch!'", "/app/.bundle/gems/ruby/1.9.1/gems/sinat-1.0/lib/sinatra/base.rb:411:in `block in call!'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `instance_eval'", "/appbundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `block in invoke'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/ba.rb:566:in `catch'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `invoke'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra.0/lib/sinatra/base.rb:411:in `call!'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:399:in `call'", "/app/.bundle/gems/ruby/1.1/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `block in call'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:1005:in `synchroze'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `call'", "/home/heroku_rack/lib/static_assets.rb:9:in `call'", "/homheroku_rack/lib/last_access.rb:15:in `call'", "/app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.rb:47:in `block in call'", "/app/.bundleems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.rb:41:in `each'", "/app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.rb:41:in `call'", "/he/heroku_rack/lib/date_header.rb:14:in `call'", "/app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:77:in `call'", "/app/.bundle/gems/by/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:76:in `block in pre_process'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb::in `catch'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:74:in `pre_process'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2/lib/thin/connection.rb:57:in `process'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:42:in `receive_data'","/app/.bundle/ms/ruby/1.9.1/gems/eventmachine0.12.10/lib/eventmachine.rb:256:in`run_machine'","/app/.bundle/gems/ruby/1.9.1/gems/eventmachine0.12.10/lib/eventchine.rb:256:in `run'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/backends/base.rb:57:in `start'", "/app/.bundle/gems/ruby/1.9.1/gems/tn-1.2.7/lib/thin/server.rb:156:in `start'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/controllers/controller.rb:80:in `start'", "/app/.ndle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:143: `run!'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/bin/thin:6:in `<top (required)>'", "/app/.bundle/gems/ruby/1.9.1/bin/thin:19:in `load'", "/a/.bundle/gems/ruby/1.9.1/bin/thin:19:in `<main>'"]
Running on Windows 7.
Please help!
You could try using the pgbackups addon if you're not changing the DB between local and production.
It is more reliable and usually faster than a db:push/db:pull.
https://devcenter.heroku.com/articles/pgbackups
Has anyone seen this? Here's the error:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -rrubygems -e "require 'redgreen'" -I.:lib:test -rubygems -e "['test/unit', 'test/test_authentication.rb'].each { |f| require f }" | /Library/Ruby/Gems/1.8/gems/autotest-4.3.2/bin/unit_diff -u
Load/Library/Ruby/Gems/1.8/gems/mocha-0.9.8/lib/mocha/integration/test_unit/gem_version_201_and_above.rb:31:in `run': undefined method `handle_exception' for #<TestAuthentication:0x101823988> (NoMethodError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in `start_mediator'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit.rb:278
from -e:2
ed suite -e
Started
And this is the code that triggers that error:
require 'test/unit'
require 'mocha'
require 'authentication'
class TestAuthentication < Test::Unit::TestCase
end
This is fixed in the HEAD version of Mocha, but has not yet been released. I hope to release it soon. Please email the mailing list if it has not been released in the next few days.
deltrem#deltrem-desktop:~/ramaze web/app/blog$ ruby start.rb
I [2010-06-10 14:53:33 $1886] INFO | : activating sequel
I [2010-06-10 14:53:33 $1886] INFO | : Installing sequel
/usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:124:in `initialize': Permission denied - /home/deltrem/.gem/ruby/1.8/cache/sequel-3.9.0.gem (Errno::EACCES)
from /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:124:in `open'
from /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:124:in `download'
from /usr/local/lib/site_ruby/1.8/rubygems/dependency_installer.rb:257:in `install'
from /usr/local/lib/site_ruby/1.8/rubygems/dependency_installer.rb:247:in `each'
from /usr/local/lib/site_ruby/1.8/rubygems/dependency_installer.rb:247:in `install'
from /usr/lib/ruby/gems/1.8/gems/ramaze-2010.04.04/lib/ramaze/setup.rb:91:in `install_gem'
from /usr/lib/ruby/gems/1.8/gems/ramaze-2010.04.04/lib/ramaze/setup.rb:102:in `temp_argv'
from /usr/lib/ruby/gems/1.8/gems/ramaze-2010.04.04/lib/ramaze/setup.rb:89:in `install_gem'
from /usr/lib/ruby/gems/1.8/gems/ramaze-2010.04.04/lib/ramaze/setup.rb:80:in `setup_gem'
from /usr/lib/ruby/gems/1.8/gems/ramaze-2010.04.04/lib/ramaze/setup.rb:63:in `setup'
from /usr/lib/ruby/gems/1.8/gems/ramaze-2010.04.04/lib/ramaze/setup.rb:62:in `each'
from /usr/lib/ruby/gems/1.8/gems/ramaze-2010.04.04/lib/ramaze/setup.rb:62:in `setup'
from /usr/lib/ruby/gems/1.8/gems/ramaze-2010.04.04/lib/ramaze/setup.rb:44:in `run'
from /usr/lib/ruby/gems/1.8/gems/ramaze-2010.04.04/lib/ramaze/setup.rb:38:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/ramaze-2010.04.04/lib/ramaze/setup.rb:29:in `new'
from /usr/lib/ruby/gems/1.8/gems/ramaze-2010.04.04/lib/ramaze/setup.rb:29:in `setup'
from ./app.rb:4
from start.rb:3:in `require'
from start.rb:3
I have no idea what this is for, but the error message seems pretty clear:
Permission denied - /home/deltrem/.gem/ruby/1.8/cache/sequel-3.9.0.gem (Errno::EACCES)
You don't have permission to read or write to that path. Are you supposed to sudo this?