view · edit · sidebar · attach · print · history

20130701-debug-yus-error-and-index-therapeutics-exporter

<< | Index | >>


Summary

  • Debug yus error
  • Debug error of exporter job (index_threapeutics)

Commits / Patches

Index / Status


Debug yus error

Privilege Error

Yus::NotPrivilegedError
You are not privileged to edit yus.entities
error in SBSM::Session#http_headers: /de/gcc/company/ean/7601001320451
Yus::NotPrivilegedError
You are not privileged to edit yus.entities
(drbssl://localhost:9997) /home/yasuhiro/.work/usr/ywesee/src/yus/lib/yus/session.rb:152:in `allow_or_fail'
(drbssl://localhost:9997) /home/yasuhiro/.work/usr/ywesee/src/yus/lib/yus/session.rb:77:in `entities'
/home/yasuhiro/.work/usr/ywesee/src/ch.oddb.org/src/model/user.rb:119:in `remote_call'
/home/yasuhiro/.work/usr/ywesee/src/ch.oddb.org/src/model/user.rb:111:in `method_missing'
/home/yasuhiro/.work/usr/ywesee/src/ch.oddb.org/src/view/companies/company.rb:511:in `company_users'

I got this error on my local machine,too.
This is not related in YUS configuration.
# yus on production server and on my local does not have any change in configuration.

% be bin/yus_show "yasaka@ywesee.com"
Password for xxxxxx: 
["yasaka@ywesee.com",
 ["accept_experience",
  [["074acf1a0b5b78f54348f3fe71020da1", Sat Aug 11 14:32:42 +0900 2012],
   ...
   ...
   ["fcc7c39811e12bbf39c25f17681b6142", Sat Aug 11 17:10:00 +0900 2012]]],
 ["ch.bbmb.admin", [["everything"]]],
 ["ch.bbmb.customer", [["everything"]]],
 ["ch.ddbd.admin", []],
 ["edit", [["org.oddb.drugs"], ["yus.entities"]]],                            #=> yus.entities
 ["login", [["ch.bbmb.Customer"], ["org.oddb.RootUser"]]],                    #=> RootUser
 ["reset_password",
  [["904114cc33c6383ca1fbab0334a55b26", Sat Aug 11 17:40:08 +0900 2012]]],
 ["set_password", [["yasaka@ywesee.com"]]],
 ["RootUser"]]
[1] 1.9.3-p194(#<ODDB::View::Companies::RootPharmaCompanyComposite>)> @session.user
=> #<ODDB::YusUser:0x00000006cc0d70
 @yus_session=
  #<DRb::DRbObject:0x00000006cc0ff0
   @ref=70265520744380,
   @uri="drbssl://localhost:9997">>
[2] 1.9.3-p194(#<ODDB::View::Companies::RootPharmaCompanyComposite>)> @session.user.entities
Yus::NotPrivilegedError: You are not privileged to edit yus.entities
from (drbssl://localhost:9997) /home/yasuhiro/.work/usr/ywesee/src/yus/lib/yus/session.rb:152:in `allow_or_fail'
[3] 1.9.3-p194(#<ODDB::View::Companies::RootPharmaCompanyComposite>)> @session.login
Yus::UnknownEntityError: Unknown Entity ''
from (drbssl://localhost:9997) /home/yasuhiro/.work/usr/ywesee/src/yus/lib/yus/server.rb:58:in `authenticate'

YusAuthentication is not problem.
This is caused at Showing company users, in View.

Debug Yus

Why allow_or_fail method raise Error ?
@user.privileged? method works inner of allow_or_fail, expectedly.

[1] 1.8.7-p358(#<Yus::TokenSession>)> allow_or_fail("edit", "yus.entities")
Yus::NotPrivilegedError: You are not privileged to edit yus.entities
from /home/yasuhiro/.work/usr/ywesee/src/yus/lib/yus/session.rb:154:in `allow_or_fail'
[2] 1.8.7-p358(#<Yus::TokenSession>)> allowed?("edit", "yus.entities")
=> false
[3] 1.8.7-p358(#<Yus::TokenSession>)> @user.class
=> Yus::Entity
[4] 1.8.7-p358(#<Yus::TokenSession>)> @user.affiliations
=> [#<ODBA::Stub:69988536648180#3 @odba_class= @odba_container=69988536712280#16>]
[5] 1.8.7-p358(#<Yus::TokenSession>)> @user.valid?
=> true
[6] 1.8.7-p358(#<Yus::TokenSession>)> @user.privileged?("edit", "yus.entities")
=> true

[11] 1.8.7-p358(#<Yus::TokenSession>)> @user.pry
[1] 1.8.7-p358(#<Yus::Entity>)> valid? && privileged?("edit", "yus.entities") || @affiliations.first.allowed?("edit", "yus.entities")
=> true

Yus::TokenSession is wrong.
In here, User (Entity) must be EntitySession.

This means that somewhere (in session class of ODDB, SBSM), login_token is called, unexpectedly.

lib/yus/session.rb
  class TokenSession < EntitySession
    def allowed?(*args)
      key, arg, = args
      if key == 'set_password' || ( key == 'edit' && arg == 'yus.entities' )
        false
      else
        super
      end 
    end 
  end 

Tthis is caused by influence by my previouse commit for login redirect. (for snapping to Search Result.)
I have to think idea that to solve these both problems.(yus edit entities and login redirect)

Repaired TestCase for ODDB::Session

Repaired

  • test_interaction_basket
  • test_navigation

Updated

  • test_login
  • test_login_token
  • test_process
  • test_limit_queries

Added

  • test_login_with_remember_me
  • test_process__no_change_in_logged_in_user_entity

Now, all cases are passed.

Finished in 0.052837738 seconds.

30 tests, 31 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

567.78 tests/s, 586.70 assertions/s
commit

Debug index_therapeutics exporter error

Error: DRb::DRbConnError
Message: druby://localhost:10005 - #<Errno::ECONNREFUSED: Connection refused - connect(2)>
Backtrace:
/usr/local/lib/ruby/1.9.1/drb/drb.rb:736:in `rescue in block in open'
/usr/local/lib/ruby/1.9.1/drb/drb.rb:730:in `block in open'
/usr/local/lib/ruby/1.9.1/drb/drb.rb:729:in `each'
/usr/local/lib/ruby/1.9.1/drb/drb.rb:729:in `open'
/usr/local/lib/ruby/1.9.1/drb/drb.rb:1191:in `initialize'
/usr/local/lib/ruby/1.9.1/drb/drb.rb:1171:in `new'
/usr/local/lib/ruby/1.9.1/drb/drb.rb:1171:in `open'
/usr/local/lib/ruby/1.9.1/drb/drb.rb:1087:in `block in method_missing'
/usr/local/lib/ruby/1.9.1/drb/drb.rb:1105:in `with_friend'
/usr/local/lib/ruby/1.9.1/drb/drb.rb:1086:in `method_missing'
/var/www/oddb.org/src/plugin/csv_export.rb:160:in `export_index_therapeuticus'
/var/www/oddb.org/src/util/exporter.rb:161:in `block in export_index_therapeuticus_csv'
/var/www/oddb.org/src/util/exporter.rb:435:in `call'
/var/www/oddb.org/src/util/exporter.rb:435:in `safe_export'
/var/www/oddb.org/src/util/exporter.rb:159:in `export_index_therapeuticus_csv'
/var/www/oddb.org/src/util/exporter.rb:59:in `run'
/var/www/oddb.org/jobs/export_daily:13:in `block in <module:Util>'
/var/www/oddb.org/src/util/job.rb:40:in `call'
/var/www/oddb.org/src/util/job.rb:40:in `run'
/var/www/oddb.org/jobs/export_daily:12:in `<module:Util>'
/var/www/oddb.org/jobs/export_daily:11:in `<module:ODDB>'
/var/www/oddb.org/jobs/export_daily:10:in `<main>'

suspend


Debug DRb Connection Error on Production

Invoicer

Errno::EADDRNOTAVAIL
Cannot assign requested address - bind(2)
["/usr/local/bin/ruby186/lib/ruby/1.8/drb/drb.rb:865:in `initialize'",
 "/usr/local/bin/ruby186/lib/ruby/1.8/drb/drb.rb:865:in `open'",
 "/usr/local/bin/ruby186/lib/ruby/1.8/drb/drb.rb:865:in `open_server'",
 "/usr/local/bin/ruby186/lib/ruby/1.8/drb/drb.rb:759:in `open_server'",
 "/usr/local/bin/ruby186/lib/ruby/1.8/drb/drb.rb:757:in `each'",
 "/usr/local/bin/ruby186/lib/ruby/1.8/drb/drb.rb:757:in `open_server'",
 "/usr/local/bin/ruby186/lib/ruby/1.8/drb/drb.rb:1340:in `initialize'",
 "/usr/local/bin/ruby186/lib/ruby/1.8/drb/drb.rb:1628:in `new'",
 "/usr/local/bin/ruby186/lib/ruby/1.8/drb/drb.rb:1628:in `start_service'",
 "/usr/local/bin/ruby186/lib/ruby/gems/1.8/gems/ydim-1.0.0/lib/ydim/client.rb:12:in `initialize'",  #=> client_url
 "/usr/local/share/src/bbmb/lib/bbmb/util/invoicer.rb:116:in `new'",
 "/usr/local/share/src/bbmb/lib/bbmb/util/invoicer.rb:116:in `ydim_connect'",
 "/usr/local/share/src/bbmb/lib/bbmb/util/invoicer.rb:44:in `create_invoice'",
 "/usr/local/share/src/bbmb/lib/bbmb/util/invoicer.rb:27:in `run'",
 "/usr/local/share/src/bbmb/lib/bbmb/util/server.rb:67:in `invoice'",
 "/usr/local/share/src/bbmb/lib/bbmb/util/server.rb:103:in `run_invoicer'",
 "/usr/local/share/src/bbmb/lib/bbmb/util/server.rb:92:in `loop'",
 "/usr/local/share/src/bbmb/lib/bbmb/util/server.rb:92:in `run_invoicer'",
 "/usr/local/share/src/bbmb/lib/bbmb/util/server.rb:90:in `initialize'",
 "/usr/local/share/src/bbmb/lib/bbmb/util/server.rb:90:in `new'",
 "/usr/local/share/src/bbmb/lib/bbmb/util/server.rb:90:in `run_invoicer'",
 "/var/www/vetoquinol.bbmb.ch//bin/bbmbd:46"]

Errno::EADDRNOTAVAIL - the specified sockaddr is not available from the local machine

fastpower bbmb $ cd /var/www/vetoquinol.bbmb.ch/
fastpower vetoquinol.bbmb.ch $ grep -r client_url .
./etc/ydim.yml:client_url: 'druby://192.168.0.35:0'

Checked stunnel

Re-Setuped Daemontools for stunnell.
Becaus it does not have any log data.

@4000000051d128cb1bd77eac 2013.07.01 08:59:13 LOG5[31825:139974490986224]: FIPS mode is disabled
@4000000051d128cb1bd78e4c 2013.07.01 08:59:13 LOG5[31825:139974490986224]: Configuration successful
@4000000051d128df084f1534 2013.07.01 08:59:33 LOG5[31825:139974490941776]: Service [gmail] accepted connection from 127.0.0.1:44023
@4000000051d128df0d69307c 2013.07.01 08:59:33 LOG5[31825:139974490941776]: connect_blocking: connected 74.125.143.109:995
@4000000051d128df0d693464 2013.07.01 08:59:33 LOG5[31825:139974490941776]: Service [gmail] connected remote server from 62.12.131.46:52224
@4000000051d128e039a10f34 2013.07.01 08:59:34 LOG5[31825:139974490941776]: Connection closed: 67 byte(s) sent to SSL, 118 byte(s) sent to socket
@4000000051d128e039a23044 2013.07.01 08:59:34 LOG5[31825:139974490831184]: Service [gmail] accepted connection from 127.0.0.1:44025
@4000000051d128e1038344e4 2013.07.01 08:59:35 LOG5[31825:139974490831184]: connect_blocking: connected 74.125.143.108:995
@4000000051d128e1038348cc 2013.07.01 08:59:35 LOG5[31825:139974490831184]: Service [gmail] connected remote server from 62.12.131.46:48216
@4000000051d128e117fc4fec 2013.07.01 08:59:35 LOG5[31825:139974490831184]: Connection closed: 58 byte(s) sent to SSL, 118 byte(s) sent to socket

Check YDIM Client

Client serve is localhost (Fastpower).

But configuration was 192.168.0.35

fastpower vetoquinol.bbmb.ch $ ping -c 3 192.168.0.35  #=> Missing
PING 192.168.0.35 (192.168.0.35) 56(84) bytes of data.
From 192.168.0.37 icmp_seq=1 Destination Host Unreachable
From 192.168.0.37 icmp_seq=2 Destination Host Unreachable
From 192.168.0.37 icmp_seq=3 Destination Host Unreachable

--- 192.168.0.35 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 1999ms
, pipe 3
fastpower vetoquinol.bbmb.ch # ping -c 3 192.168.0.36   #=> Thinpower
PING 192.168.0.36 (192.168.0.36) 56(84) bytes of data.
64 bytes from 192.168.0.36: icmp_seq=1 ttl=64 time=1.61 ms
64 bytes from 192.168.0.36: icmp_seq=2 ttl=64 time=0.150 ms
64 bytes from 192.168.0.36: icmp_seq=3 ttl=64 time=0.121 ms

--- 192.168.0.36 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.121/0.627/1.610/0.695 ms

Then I changed to localhost

for

  • vetoquinol.bbmb.ch
  • sandoz.bbmb.ch
test script

But, alloga.bbmb.ch uses another way.
And it has other problem.

@4000000051cf66fa0347c66c BbmbApp::update - updating
@4000000051cf66fa0347ce3c BbmbApp::update - updating Globopharm
@4000000051cf66fa0347ce3c update: update_stock
@4000000051cf66fa16bf3054 Net::FTPPermError
@4000000051cf66fa16bf343c /OUT/Items.csv
@4000000051cf66fa16bf343c 550 Failed to open file.
@4000000051cf66fa16bf3824 update_stock done
@4000000051cf66fd2b7870dc update: update_users
@4000000051cf66fe0caa0ecc Net::FTPPermError
@4000000051cf66fe0caa169c /OUT/Customers.csv
@4000000051cf66fe0caa169c 550 Failed to open file.
@4000000051cf66fe0caa169c update_users done
@4000000051cf67012b470484 update: update_group_access
@4000000051cf6702006ec954 Net::FTPPermError
@4000000051cf6702006ecd3c /OUT/ywsbezber
@4000000051cf6702006ed124 550 Failed to open file.
@4000000051cf6702006ed124 update_group_access done
@4000000051cf67051cfcb914 update: update_stock_atc
@4000000051cf67051d6a01a4 update_stock_atc done
@4000000051cf670826f4a224 update: update_sl
@4000000051cf67082708ca4c update_sl done
@4000000051cf670b285b0054 update: update_atc_classes
@4000000051cf670b286fd45c update_atc_classes done
@4000000051cf670e27a9e864 update: update_fachinfos
@4000000051cf670e27be5ac4 update_fachinfos done
@4000000051cf67b714cdf35c /var/www/bbmb.ch/src/util/bbmbapp.rb:389: [BUG] Segmentation fault #=> Seg fault.
@4000000051cf67b714ce06e4 ruby 1.8.6 (2009-06-08) [x86_64-linux]
view · edit · sidebar · attach · print · history
Page last modified on July 02, 2013, at 04:45 AM