I am using Sidekiq 3 in my ruby on rails 3.2 application. How can I handle exception in Sidekiq jobs without plugin (for example: Honeybadger, Airbrake, Rollbar, BugSnag).
I want to catch exception that occurs in the job.
Bugsnag actually comes with built-in support for catching errors in both Sidekiq 2 and 3, so it will automatically detect any exceptions in your sidekiq jobs!
Related
I'm trying the new Symfony 4 and Sentry error tracking.
On dev env, notice and exception are handled the same way with a nice screen thanks to the Debug class.
On prod env, exception triggers the nice error page and a log entry in Sentry.
But notices do not trigger this nice page but the code keeps going after the notice: is there a different handling process in prod env for notice?
Something strange: in prod this notice is reported as an ErrorException exception which means that the notice is turned into exception at some point.
Thank you for your help!
Turning an error into an exception depends on this parameter
https://symfony.com/doc/current/reference/configuration/framework.html#throw which defaults to kernel.debug which is off in prod env.
So you can change this framework.php_errors.throw to true and keep kernel.debug to false in prod env which solved my issue.
I am trying to run calabash-android to test my app, but I get the following error, the same app without any modification was working before I tried to do some modifications, but then I reverted all the modifications to the app :
Exception occurred while dumping:
java.lang.IllegalArgumentException: Unknown package: com.bitbar.testdroid
at com.android.server.pm.Settings.isOrphaned(Settings.java:4134)
at com.android.server.pm.PackageManagerService.isOrphaned(PackageManagerService.java:18091)
at com.android.server.pm.PackageManagerService.deletePackage(PackageManagerService.java:15508)
at com.android.server.pm.PackageInstallerService.uninstall(PackageInstallerService.java:888)
at com.android.server.pm.PackageManagerShellCommand.runUninstall(PackageManagerShellCommand.java:792)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:118)
at android.os.ShellCommand.exec(ShellCommand.java:94)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:18349)
at android.os.Binder.shellCommand(Binder.java:468)
at android.os.Binder.onTransact(Binder.java:367)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2387)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:3031)
at android.os.Binder.execTransact(Binder.java:565)
And then
Success
Success
Scenario: I can choose a file from the Gallery # features/my_first.feature:3
HTTPClient::KeepAliveDisconnected: Connection reset by peer # io_fillbuf - fd:8 (HTTPClient::KeepAliveDisconnected)
./features/support/app_life_cycle_hooks.rb:5:in `Before'
When I take a screenshot # calabash-android-0.9.0/lib/calabash-android/steps/screenshot_steps.rb:9
Then I take a screenshot # calabash-android-0.9.0/lib/calabash-android/steps/screenshot_steps.rb:9
Failing Scenarios:
cucumber features/my_first.feature:3 # Scenario: I can choose a file from the Gallery
1 scenario (1 failed)
2 steps (2 skipped)
0m6.240s
Exception ScreenShot
I solved the problem by running the build using the gradle task :app:assembleDebug
in the exception above, calabash can't find the package name, because it is on another dex class.
I think in calabash, they may be having problem with multidex projects, and Android Studio will always enable multidex to your app, even if it doesn't need it.
I am not an expert, any suggestion are welcome, and I hope some people can benefit from this answer.
I recently noticed my NSB log files where growing up significantly because of a warning I have never noticed before.
2017-03-21 12:17:50.554 WARN NServiceBus.Timeout.Hosting.Windows.TimeoutPersisterReceiver Failed to fetch timeouts from the timeout storage
System.NullReferenceException: La référence d'objet n'est pas définie à une instance d'un objet.
à NServiceBus.Timeout.Hosting.Windows.TimeoutPersisterReceiver.Poll(Object obj) dans C:\BuildAgent\work\3206e2123f54fce4\src\NServiceBus.Core\Timeout\Hosting\Windows\TimeoutPersisterReceiver.cs:ligne 90
à System.Threading.Tasks.Task.Execute()
2017-03-21 12:17:50.560 INFO NServiceBus.CircuitBreakers.RepeatedFailuresOverTimeCircuitBreaker The circuit breaker for TimeoutStorageConnectivity is now in the armed state
This warning appears every seconds so you can imagine the size of my log files.
I noticed this warning when I adjust the NServiceBus log level because I had several unexplained crash in my service. I have found that this warning makes my service crashing after a while causing a FatalExecutionEngineError exception (see screenshot below).
I am using NServiceBus 5.2.21.
Does anyone can help me getting rid of this warning?
I solved my problem using an older version of NServiceBus (5.2.14). Above this version, the problem appears and everything works fine from and below this version.
According to my tests, it seems that crashes don't appear when NServiceBus logging feature is disabled. As I am not using Timeouts in NServiceBus, everything works fine when logs are disabled. It looks like a conccurent access issue between thread occurs.
Maybe this bug has never been seen since this is an old version and as NServiceBus current version is 6.x (7.x coming), it has never been fixed.
This is due to a breaking change on the timeout contracts. Make sure that not only you are using the latest version of the Core, but also for the persistence.
I'm using Rails 3.2.1 and have created my own rails template. I want to display a set of instructions after the initial install, but bundler seems to run and pushes my messages up the screen.
Is there a way to stop bundler running after my template?
Or better still is there a way to display a message after bundler has run?
It's a bit of a dirty hack, but you can disable the built-in 'bundle install' invocation by overriding the run_bundle method:
def run_bundle ; end
If you still want your template to run bundle install, you can invoke this using the run command:
run "bundle install"
Alternatively, just use this line in your template:
run_bundle ; def run_bundle ; end
HTH.
Context of rails 3.0.9, using resque 1.17.1 and resque-scheduler 2.0.0.0d.
Trying to follow the document at https://github.com/bvandenbos/resque-scheduler/tree/v2.0.0.d, I've created a resque_scheduler.rake file :
# Resque tasks
require 'resque/tasks'
require 'resque_scheduler/tasks'
namespace :resque do
task :setup do
require 'resque'
require 'resque_scheduler'
require 'resque/scheduler'
# you probably already have this somewhere
Resque.redis = 'localhost:6379'
# The schedule doesn't need to be stored in a YAML, it just needs to
# be a hash. YAML is usually the easiest.
#Resque.schedule = YAML.load_file('your_resque_schedule.yml')
# If your schedule already has +queue+ set for each job, you don't
# need to require your jobs. This can be an advantage since it's
# less code that resque-scheduler needs to know about. But in a small
# project, it's usually easier to just include you job classes here.
# So, someting like this:
#require 'jobs'
# If you want to be able to dynamically change the schedule,
# uncomment this line. A dynamic schedule can be updated via the
# Resque::Scheduler.set_schedule (and remove_schedule) methods.
# When dynamic is set to true, the scheduler process looks for
# schedule changes and applies them on the fly.
# Note: This feature is only available in >=2.0.0.
Resque::Scheduler.dynamic = true
end
end
For the time being I'm only interested in delayed job, so I don't have any resque_schedule.yml file.
I've tested my worker class with resque and it is working fine. When I try to add a delay and user enqueue_at in my controller...
def do_delay_job user_id,delay
Resque.enqueue_at(delay.minutes.from_now, JobDelayer, :user_id => user_id)
#Resque.enqueue(JobDelayer, user_id) # using basic resque mechanism.
end
...it just fails
undefined method `enqueue_at' for Resque Client connected to redis://127.0.0.1:6379/0:Module
Any clue or hint to figure out this issue will be appreciated.
Here couple of issue. documentation is not alway obvious and assumed that you should know...I didn't. So after digging all over the place I got resque nice and smooth ;-)
initializers\resque.rb must reference resque_schedule.
require 'resque_scheduler'
resque task must be started:
COUNT=5 QUEUE=* rake resque:work
resque-schedule task must be started:
rake resque:scheduler
To monitor resque-schedule, resque-web must be started with the config file of resque as parameter. This one must not reference anything from rails directly as resque-web is a sinatra app and it won't be able to load it properly.
resque-web ~/pathToYourApp/config/initializers/resque.rb
Starting both worker and scheduler processes was necessary indeed.
What I found out in addition was that I needed to call
require 'resque_scheduler'
before I called Resque.enqueue_at(...). This was the very cause of "undefined method" error in my case.
And resque-web can be actually hooked to your rails app. Add following lines in "config/routes.rb", reboot rails app, then you can access to the resque-web via $YOUR_RAILS_ROOT_URL/resque.
require 'resque_scheduler'
mount Resque::Server, :at => "/resque"