TypeError: can't dump MatchData - ruby-on-rails

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

Related

Getting Error while reading a manual_test.csv file in Jupyter. (Data and warehouse mining, Machine Learning)

I am trying to run a cell in Jupyter notebook and getting permission error number 13. The code is
df_manual_testing = pd.concat([df_fake_manual_testing,df_true_manual_testing], axis = 0)
df_manual_testing.to_csv("manual_testing.csv")
The error which I am getting is:
---------------------------------------------------------------------------
PermissionError Traceback (most recent call last)
<ipython-input-16-f14a4d175882> in <module>
1 df_manual_testing = pd.concat([df_fake_manual_testing,df_true_manual_testing], axis = 0)
----> 2 df_manual_testing.to_csv("manual_testing.csv")
~\anaconda\lib\site-packages\pandas\core\generic.py in to_csv(self, path_or_buf, sep, na_rep, float_format, columns, header, index, index_label, mode, encoding, compression, quoting, quotechar, line_terminator, chunksize, date_format, doublequote, escapechar, decimal)
3202 decimal=decimal,
3203 )
-> 3204 formatter.save()
3205
3206 if path_or_buf is None:
~\anaconda\lib\site-packages\pandas\io\formats\csvs.py in save(self)
182 close = False
183 else:
--> 184 f, handles = get_handle(
185 self.path_or_buf,
186 self.mode,
~\anaconda\lib\site-packages\pandas\io\common.py in get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text)
426 if encoding:
427 # Encoding
--> 428 f = open(path_or_buf, mode, encoding=encoding, newline="")
429 elif is_text:
430 # No explicit encoding
PermissionError: [Errno 13] Permission denied: 'manual_testing.csv'
I cannot understand how to change the permission of my file. I think so I will need to change it from root to user, but I am not sure exactly how to do this.
If you are not interested in writing the csv file into the current working directory, you could simply specify the full path of a folder in which you are sure you have the permissions to write.
For example:
df_manual_testing.to_csv("C:/Users/../manual_testing.csv")
However, if you want to write in a particular folder, you can check from the terminal if you have the permissions to write here, using the command ls -lh. Eventually, you could change the permissions using the account of the owner of the folder, with the command chmod 777 myfolder.
If you need more information about file permissions, you could look at this reference.

Error while loading graphlab.SFrame('home_data.gl/')

I am doing Machine Learning Course from Coursera by University of Washington. In which I am using iPython's graphlab. During practise when I execute below command:
sales = graphlab.SFrame('home_data.gl/')
I am getting error.
IOError Traceback (most recent call last)
<ipython-input-2-e6a249ea422b> in <module>()
----> 1 sales = graphlab.SFrame('home_data.gl/')
C:\Users\chinesh\Anaconda2\envs\gl-env\lib\site-packages\graphlab\data_structures\sframe.pyc in __init__(self, data, format, _proxy)
951 pass
952 else:
--> 953 raise ValueError('Unknown input type: ' + format)
954
955 sframe_size = -1
C:\Users\chinesh\Anaconda2\envs\gl-env\lib\site-packages\graphlab\cython\context.pyc in __exit__(self, exc_type, exc_value, traceback)
47 if not self.show_cython_trace:
48 # To hide cython trace, we re-raise from here
---> 49 raise exc_type(exc_value)
50 else:
51 # To show the full trace, we do nothing and let exception propagate
IOError: C:\Users\chinesh\home_data.gl not found.
where i can find home_data.gl in my computer or the problem is something else ..
You need to have your ipynb file and the data file in the same directory for the above to work. Alternatively, specify the full or relative path of the data file in the function
sales = graphlab.SFrame('C:\FULL-PATH\home_data.gl/')
Here is a link to the course reading for how to arrange your directories for the course. https://www.coursera.org/learn/ml-foundations/supplement/IT04V/reading-where-should-my-files-go
Make sure to download the zip folder to the same folder where you will work on this data. For example: I downloaded the zip file to Downloads then I opened my notebook from the download file
Just follow the instructions and download the training data into the ipython working directory.
Go to terminal and run:
unzip home_data.gl.zip
You will see following files in directory home_data.gl:
Now in ipython, run:
sales = graphlab.SFrame('home_data.gl/')
sales
which will display the data in tabular format:

Rollbar and Rails: No route matches [GET] "/blog/wp-login.php"

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.

ActiveRecord "IOError: could not reopen: null"

I just experienced my app having errors on every page load or almost every page load. A restart cleared out all the problems. Here is what I think happened.
The first error, was "IOError: could not reopen: null"
"org/jruby/RubyIO.java" line 501 in reopen
"/app/vendor/bundle/jruby/1.9/gems/activesupport-4.0.4/lib/active_support/core_ext/kernel/reporting.rb" line 52 in silence_stream
"/app/vendor/bundle/jruby/1.9/gems/activesupport-4.0.4/lib/active_support/core_ext/kernel/reporting.rb" line 109 in quietly
"/app/vendor/bundle/jruby/1.9/gems/activesupport-4.0.4/lib/active_support/core_ext/kernel/reporting.rb" line 50 in silence_stream
"/app/vendor/bundle/jruby/1.9/gems/activesupport-4.0.4/lib/active_support/core_ext/kernel/reporting.rb" line 108 in quietly
"/app/vendor/bundle/jruby/1.9/gems/activerecord-session_store-0.1.0/lib/action_dispatch/session/active_record_store.rb" line 64 in get_session
"/app/vendor/bundle/jruby/1.9/gems/rack-1.5.2/lib/rack/session/abstract/id.rb" line 266 in load_session
"/app/vendor/bundle/jruby/1.9/gems/actionpack-4.0.4/lib/action_dispatch/middleware/session/abstract_store.rb" line 43 in load_session
"/app/vendor/bundle/jruby/1.9/gems/actionpack-4.0.4/lib/action_dispatch/middleware/session/abstract_store.rb" line 51 in stale_session_check!
"/app/vendor/bundle/jruby/1.9/gems/actionpack-4.0.4/lib/action_dispatch/middleware/session/abstract_store.rb" line 43 in load_session
"/app/vendor/bundle/jruby/1.9/gems/actionpack-4.0.4/lib/action_dispatch/request/session.rb" line 168 in load!
"/app/vendor/bundle/jruby/1.9/gems/actionpack-4.0.4/lib/action_dispatch/request/session.rb" line 160 in load_for_read!
"/app/vendor/bundle/jruby/1.9/gems/actionpack-4.0.4/lib/action_dispatch/request/session.rb" line 86 in []
"/app/vendor/bundle/jruby/1.9/gems/warden-1.2.3/lib/warden/session_serializer.rb" line 30 in fetch
"/app/vendor/bundle/jruby/1.9/gems/warden-1.2.3/lib/warden/proxy.rb" line 212 in user
...
There was only one of those. Then, on every page request, i get "Errno::EBADF: Bad file descriptor"
"org/jruby/RubyIO.java" line 2097 in close
"/app/vendor/bundle/jruby/1.9/gems/activesupport-4.0.4/lib/active_support/core_ext/kernel/reporting.rb" line 53 in silence_stream
"/app/vendor/bundle/jruby/1.9/gems/activesupport-4.0.4/lib/active_support/core_ext/kernel/reporting.rb" line 109 in quietly
"/app/vendor/bundle/jruby/1.9/gems/activesupport-4.0.4/lib/active_support/core_ext/kernel/reporting.rb" line 50 in silence_stream
"/app/vendor/bundle/jruby/1.9/gems/activesupport-4.0.4/lib/active_support/core_ext/kernel/reporting.rb" line 108 in quietly
"/app/vendor/bundle/jruby/1.9/gems/activerecord-session_store-0.1.0/lib/action_dispatch/session/active_record_store.rb" line 64 in get_session
"/app/vendor/bundle/jruby/1.9/gems/rack-1.5.2/lib/rack/session/abstract/id.rb" line 266 in load_session
"/app/vendor/bundle/jruby/1.9/gems/actionpack-4.0.4/lib/action_dispatch/middleware/session/abstract_store.rb" line 43 in load_session
...
What cause the initial problem?
weird stuff such as these are likely caused by Rails not being "absolutely" thread-safe (even on MRI but it's more obvious on JRuby since it's "GIL-free") ... Rails.logger.silence and related have not been 100% thread-safe https://gist.github.com/kares/9374772 I've dealt with similar issues (on JRuby on Rails) since 2.3 and there sure were attempts to fix this but somehow the same silencing logic keeps getting back.
the whole silence_stream(STDOUT) {} code (that your trace reveals), I would guess, might end up in a similar "unpredictable" state. I would try patching kernel/reporting.rb so that the stream silencers do nothing (I've updated the gist as well).

Erlang with Erlsom and DTD

I am trying to work with 1 GB XML and DTD file with Erlsom.
The problem is that parse_sax throws an exception becuase it cannot work with DTD file.
Basically i don't need this information so my question is how i tell the
sax_parser to just ignore this?
or even to use try and catch and when the error got catches then to skip this place on the file and continue from there.
This the exception:
** exception throw: {error,"Malformed: unknown reference: uuml"}
in function erlsom_sax_latin1:nowFinalyTranslate/3 (src/erlsom_sax_latin1.erl, line 1051)
in call from erlsom_sax_latin1:translateReferenceNonCharacter/4 (src/erlsom_sax_latin1.erl, line 1024)
in call from erlsom_sax_latin1:parseTextNoIgnore/3 (src/erlsom_sax_latin1.erl, line 922)
in call from erlsom_sax_latin1:parseContent/2 (src/erlsom_sax_latin1.erl, line 898)
in call from erlsom_sax_latin1:parse/2 (src/erlsom_sax_latin1.erl, line 172)
in call from mapReduce:run/0 (/home/alon/workspace/mapReduce/src/mapReduce.erl, line 26)(mapReduce#alon-Vostro-3300)2>
The problem is with "uuml" because in the XML file its apear with &uuml
Thanks for your help.
Hit the same error and found this in the ErlSom docs under limitations of the sax parser:
It doesn’t support entities, apart from the predefined ones (< etc.) and character references (&#nnn; and &#xhhh;).

Resources