API: 500 error getting commit diff containing binary file
Created by: andy-5
Gitlab Version 8.1.2
For commits adding a certain binary file, I get a 500 error trying to get the commit diff via the API:
$ curl "https://localhost/api/v3/projects/66/repository/commits/d0227b437caef34b390c40a300badbfc2c7a22d8/diff" -H "PRIVATE-TOKEN:*********************"
{"message":"500 Internal Server Error"}
This does NOT happen for all binary files, in fact I only noticed it for one particular file, which you can find here: https://gist.github.com/andy-5/d24b732b7d1d41361bcc/raw/b7ae5b8765804bc7bb26b1e42e47e756f356dcb5/raw_data
Here is the relevant section from production.log
:
Encoding::UndefinedConversionError ("\xFF" from ASCII-8BIT to UTF-8):
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/core_ext/object/json.rb:34:in `encode'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/core_ext/object/json.rb:34:in `to_json'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/core_ext/object/json.rb:34:in `to_json_with_active_support_encoder'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/json/encoding.rb:56:in `to_json'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/json-1.8.3/lib/json/common.rb:223:in `generate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/json-1.8.3/lib/json/common.rb:223:in `generate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/json/encoding.rb:100:in `stringify'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/json/encoding.rb:34:in `encode'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/json/encoding.rb:21:in `encode'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/core_ext/object/json.rb:37:in `to_json_with_active_support_encoder'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/formatter/json.rb:7:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/middleware/formatter.rb:34:in `block in after'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/middleware/formatter.rb:33:in `collect'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/middleware/formatter.rb:33:in `after'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/middleware/base.rb:25:in `call!'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/middleware/base.rb:18:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/middleware/base.rb:24:in `call!'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/middleware/base.rb:18:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-oauth2-1.0.10/lib/rack/oauth2/server/resource.rb:20:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-oauth2-1.0.10/lib/rack/oauth2/server/resource/bearer.rb:8:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/middleware/error.rb:26:in `block in call!'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/middleware/error.rb:25:in `catch'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/middleware/error.rb:25:in `call!'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/middleware/base.rb:18:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/head.rb:11:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/builder.rb:138:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/endpoint.rb:155:in `call!'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/endpoint.rb:145:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:152:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:96:in `block in recognize'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:159:in `optimized_each'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:95:in `recognize'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:141:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/api.rb:525:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/api.rb:42:in `call!'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/grape-0.6.1/lib/grape/api.rb:38:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.12/lib/action_dispatch/journey/router.rb:73:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.12/lib/action_dispatch/journey/router.rb:59:in `each'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.12/lib/action_dispatch/journey/router.rb:59:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.12/lib/action_dispatch/routing/route_set.rb:692:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:404:in `call_app!'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/omniauth-saml-1.4.1/lib/omniauth/strategies/saml.rb:104:in `other_phase'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:185:in `call!'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:164:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:186:in `call!'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:164:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-cors-0.4.0/lib/rack/cors.rb:80:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-attack-4.3.0/lib/rack/attack.rb:104:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/etag.rb:23:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/conditionalget.rb:25:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/head.rb:11:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.12/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.12/lib/action_dispatch/middleware/flash.rb:254:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/session/abstract/id.rb:225:in `context'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/session/abstract/id.rb:220:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.12/lib/action_dispatch/middleware/cookies.rb:562:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.12/lib/active_record/query_cache.rb:36:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.12/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/callbacks.rb:82:in `run_callbacks'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.12/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.12/lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.12/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.12/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.12/lib/rails/rack/logger.rb:38:in `call_app'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.12/lib/rails/rack/logger.rb:20:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/tagged_logging.rb:26:in `tagged'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/tagged_logging.rb:68:in `tagged'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.12/lib/rails/rack/logger.rb:20:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/request_store-1.2.0/lib/request_store/middleware.rb:8:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.12/lib/action_dispatch/middleware/request_id.rb:21:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/methodoverride.rb:21:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/runtime.rb:17:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/lock.rb:17:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/sendfile.rb:112:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.12/lib/rails/engine.rb:514:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.12/lib/rails/application.rb:144:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.12/lib/rails/railtie.rb:194:in `public_send'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/railties-4.1.12/lib/rails/railtie.rb:194:in `method_missing'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/builder.rb:138:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/urlmap.rb:65:in `block in call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/urlmap.rb:50:in `each'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/rack-1.5.5/lib/rack/urlmap.rb:50:in `call'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:576:in `process_client'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-worker-killer-0.4.3/lib/unicorn/worker_killer.rb:52:in `process_client'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:670:in `worker_loop'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:525:in `spawn_missing_workers'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:536:in `maintain_worker_count'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:294:in `join'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/bin/unicorn_rails:209:in `<top (required)>'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/bin/unicorn_rails:23:in `load'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/bin/unicorn_rails:23:in `<main>'