I've inherited an app from another developer and have added an error notification service, and have now received 1,408 occurrences of an error that I am having trouble getting to the bottom of...
The error is simply:
TypeError: can't dump MatchData
with only non-project frames in the stack trace....
I can see where this error is ultimately occurring in the activesupport gem message_verifier.rb file, but I assume that there's an error in the application or configuration that is causing it originally, and am not sure the best approach how to trace this back to its point of origin on our end. Strikes me as the kind of thing that someone may look at and immediately see recognize it. And advice appreciated....
This is the stack trace:
File "xxx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/message_verifier.rb" line 53 in dump
File "xxx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/message_verifier.rb" line 53 in generate
File "xxx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/cookies.rb" line 300 in []=
File "xxx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/session/cookie_store.rb" line 64 in set_cookie
File "xxx/shared/bundle/ruby/1.9.1/gems/rack-1.4.7/lib/rack/session/abstract/id.rb" line 335 in commit_session
File "xxx/shared/bundle/ruby/1.9.1/gems/rack-1.4.7/lib/rack/session/abstract/id.rb" line 211 in context
File "xxx/shared/bundle/ruby/1.9.1/gems/rack-1.4.7/lib/rack/session/abstract/id.rb" line 205 in call
File "xxx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/cookies.rb" line 341 in call
File "xxx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.22.2/lib/active_record/query_cache.rb" line 64 in call
File "xxx/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.22.2/lib/active_record/connection_adapters/abstract/connection_pool.rb" line 479 in call
File "xxx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/callbacks.rb" line 28 in block in call
File "xxx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb" line 405 in _run__656928281__call__438689938__callbacks
File "xxx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb" line 405 in __run_callback
File "xxx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb" line 385 in _run_call_callbacks
File "xxx/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.22.2/lib/active_support/callbacks.rb" line 81 in run_callbacks
File "xxx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/callbacks.rb" line 27 in call
File "xxx/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.22.2/lib/action_dispatch/middleware/remote_ip.rb" line 31 in
I recently installed Rollbar on my to-be Production instance and I see that Rollbar has starting reporting this issue about not finding a WordPress login.
ActionController::RoutingError: No route matches [GET] "/blog/wp-login.php"
I searched through all my code and dont find any references wp-login.php and the stack trace is not helping either. Would you know where this might be coming from?
"/home/myproject/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/debug_exceptions.rb" line 21 in call
"/home/myproject/shared/bundle/ruby/2.1.0/gems/rollbar-2.7.1/lib/rollbar/middleware/rails/show_exceptions.rb" line 22 in call_with_rollbar
"/home/myproject/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/show_exceptions.rb" line 30 in call
"/home/myproject/shared/bundle/ruby/2.1.0/gems/railties-4.0.13/lib/rails/rack/logger.rb" line 38 in call_app
"/home/myproject/shared/bundle/ruby/2.1.0/gems/railties-4.0.13/lib/rails/rack/logger.rb" line 20 in block in call
"/home/myproject/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.13/lib/active_support/tagged_logging.rb" line 68 in block in tagged
"/home/myproject/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.13/lib/active_support/tagged_logging.rb" line 26 in tagged
"/home/myproject/shared/bundle/ruby/2.1.0/gems/activesupport-4.0.13/lib/active_support/tagged_logging.rb" line 68 in tagged
"/home/myproject/shared/bundle/ruby/2.1.0/gems/railties-4.0.13/lib/rails/rack/logger.rb" line 20 in call
"/home/myproject/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/request_id.rb" line 21 in call
"/home/myproject/shared/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/methodoverride.rb" line 21 in call
"/home/myproject/shared/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/runtime.rb" line 17 in call
"/home/myproject/shared/bundle/ruby/2.1.0/gems/actionpack-4.0.13/lib/action_dispatch/middleware/static.rb" line 84 in call
"/home/myproject/shared/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/send.rb" line 112 in call
"/home/myproject/shared/bundle/ruby/2.1.0/gems/railties-4.0.13/lib/rails/engine.rb" line 511 in call
"/home/myproject/shared/bundle/ruby/2.1.0/gems/railties-4.0.13/lib/rails/application.rb" line 97 in call
"/home/myproject/shared/bundle/ruby/2.1.0/gems/railties-4.0.13/lib/rails/railtie/configurable.rb" line 30 in method_missing
"/home/myproject/shared/bundle/ruby/2.1.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb" line 562 in process_client
"/home/myproject/shared/bundle/ruby/2.1.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb" line 658 in worker_loop
"/home/myproject/shared/bundle/ruby/2.1.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb" line 508 in spawn_missing_workers
"/home/myproject/shared/bundle/ruby/2.1.0/gems/unicorn-5.0.1/lib/unicorn/http_server.rb" line 132 in start
"/home/myproject/shared/bundle/ruby/2.1.0/gems/unicorn-5.0.1/bin/unicorn" line 126 in <top (required)>
"/home/myproject/shared/bundle/ruby/2.1.0/bin/unicorn" line 23 in load
"/home/myproject/shared/bundle/ruby/2.1.0/bin/unicorn" line 23 in <main>
This is just the random background noise of the internet - scripts wander around looking for known security holes (in this case, one in WordPress) that their human might want to exploit. If someone ever puts your link into an MS Office document, you'll also see weird OPTIONS requests.
It's common to configure error reporting to ignore RoutingErrors, though of course there are pros and cons to that. It lets you ignore this noise, which can trigger false alarms, but if you ever actually render a bad URL, it can go unnoticed.
I'm using ruby 2.1.0 and Rails 4.1.0
If I put a debugger statement anywhere in my rake code, I get this:
home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/monitor.rb:213
mon_exit
[208, 217] in /home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/monitor.rb
208 def mon_synchronize
209 mon_enter
210 begin
211 yield
212 ensure
=> 213 mon_exit
214 end
215 end
216 alias synchronize mon_synchronize
217
(rdb:1)
I cannot access any of the local variables in my code.
Monitor appears to be a threading library... so how do I get the debugger statement to run properly?
The issue was putting "debugger" at the end of a method, which would make it the return value.
The fix... don't put debugger at the end of a method.
On Season 12 Episode 07 "The Great Money Caper" of The Simpsons, I noticed a few years ago "gibberish" signs on the Russian spaceship. Randomly today, I decided to search and see if anyone decoded them but couldn't find any results.
I suspect that it is KOI8-R showing up as either Latin-1 or Windows-1252. The image I could grab is not very clear.
I have two interpretations of the mojibake as shown in this Python 3 code interpreter interaction:
>>> 'Ï‹ÏËÏÁ ¿Ä ÄÏÍ.†.'.encode('windows-1252').decode('koi8_r')
'о▀окоа ©д дом.├.'
>>> 'Ï<ÏËÏÁ ¿Ä ÄÏÍ.×.'.encode('latin1').decode('koi8_r')
'о<окоа ©д дом.в.'
Looking at the code charts on Wikpedia, I cannot figure out what the "<"-like and "+"-like symbols are. I thought about brute-forcing and matching it with some sort of spellcheck dictionary but I would rather get some help first.
Can the original text or meaning still be recovered? Or is it really gibberish?
(I appreciate if someone knows what it says, but I would like to see if its possible to solve this through some code.)
Edit: A naive script:
codec_list = ['ascii', 'big5', 'big5hkscs', 'cp037', 'cp424', 'cp437',
'cp500', 'cp720', 'cp737', 'cp775', 'cp850', 'cp852', 'cp855', 'cp856',
'cp857', 'cp858', 'cp860', 'cp861', 'cp862', 'cp863', 'cp864', 'cp865',
'cp866', 'cp869', 'cp874', 'cp875', 'cp932', 'cp949', 'cp950', 'cp1006',
'cp1026', 'cp1140', 'cp1250', 'cp1251', 'cp1252', 'cp1253', 'cp1254',
'cp1255', 'cp1256', 'cp1257', 'cp1258', 'euc_jp', 'euc_jis_2004',
'euc_jisx0213', 'euc_kr', 'gb2312', 'gbk', 'gb18030', 'hz', 'iso2022_jp',
'iso2022_jp_1', 'iso2022_jp_2', 'iso2022_jp_2004', 'iso2022_jp_3',
'iso2022_jp_ext', 'iso2022_kr', 'latin_1', 'iso8859_2', 'iso8859_3',
'iso8859_4', 'iso8859_5', 'iso8859_6', 'iso8859_7', 'iso8859_8',
'iso8859_9', 'iso8859_10', 'iso8859_13', 'iso8859_14', 'iso8859_15',
'iso8859_16', 'johab', 'koi8_r', 'koi8_u', 'mac_cyrillic', 'mac_greek',
'mac_iceland', 'mac_latin2', 'mac_roman', 'mac_turkish', 'ptcp154',
'shift_jis', 'shift_jis_2004', 'shift_jisx0213', 'utf_32', 'utf_32_be',
'utf_32_le', 'utf_16', 'utf_16_be', 'utf_16_le', 'utf_7', 'utf_8',
'utf_8_sig',]
source_str_list = ['Ï‹ÏËÏÁ ¿Ä ÄÏÍ.†.', 'Ï<ÏËÏÁ ¿Ä ÄÏÍ.×.']
for mangled_codec in codec_list:
for correct_codec in codec_list:
decoded_str_list = []
for s in source_str_list:
try:
decoded_str_list.append(s.encode(mangled_codec
).decode(correct_codec))
except (UnicodeEncodeError, UnicodeDecodeError):
continue
if decoded_str_list:
print(mangled_codec, correct_codec, decoded_str_list)
Ï‹ÏËÏÁ¿ÄÄÏÍ.†.
gbk 15 5 '蠇纤狭磕南'
cp932, sjis 31 11 'マ均ヒマチソトトマヘ.'
cp1250 28 14 'Ď‹ĎËĎÁżÄÄĎÍ.†.'
cp1251 28 14 'П‹ПЛПБїДДПН.†.'
cp1256 28 14 'د‹دثدء؟ؤؤدح.†.'
cp1257 28 14 'Ļ‹ĻĖĻĮæÄÄĻĶ.†.'
geostd8 37 14 'ო‹ოლობ¿ეეონ.†.'
Ï<ÏËÏÁ ¿Ä ÄÏÍ
euckr 31 11 '횕<횕횏횕횁쩔횆횆횕횒'
gbk 31 11 '脧<脧脣脧脕驴脛脛脧脥'
Mojibake for Cyrillic usually involves 'eth':
АБВГҐДЂ -> ÐБВГÒДЂ
Mojibaking Greek gets Î and Ï.
When stepping through the Ruby Debugger in Rails, how do I only have it stop only at code that I wrote, skipping over all the native Rails code?
(ie skipping all the code that looks like this)
/Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/core_ext/module/remove_method.rb:4
remove_method(method)
(rdb:1) s
[76, 85] in /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/core_ext/class/attribute.rb
76 def self.#{name}?() !!#{name} end
77
78 def self.#{name}=(val)
79 singleton_class.class_eval do
80 remove_possible_method(:#{name})
=> 81 define_method(:#{name}) { val }
82 end
83
84 if singleton_class?
85 class_eval do
/Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/core_ext/class/attribute.rb:81
define_method(:#{name}) { val }
(rdb:1) s
[79, 88] in /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/core_ext/class/attribute.rb
79 singleton_class.class_eval do
80 remove_possible_method(:#{name})
81 define_method(:#{name}) { val }
82 end
83
=> 84 if singleton_class?
85 class_eval do
86 remove_possible_method(:#{name})
87 def #{name}
88 defined?(##{name}) ? ##{name} : singleton_class.#{name}
Thanks!
I think what your looking for is something like this if I understand your question right.
You'll want to step over rather than step into, that way if your using a method for rails you don't go into the rails code. I hope this helps and good luck.
If you occasionally stepped in some Rails code, just press c in a console. This will move you to the next breakpoint you have set (or return to the same one if you're inside a loop) or will simply end page request if there's no breakpoints left.
There are 3 major debugging commands
c - Continue
s - Step into
n - next/ Step over
What you're looking for is "n", it allows you to go through a list of methods without going into the code or ruby gem that contains the rest of the code.