view · edit · sidebar · attach · print · history

20130311-debug-swissmedic-job-and-invoice-job

<< | Index | >>


Summary

  • Debug Broken Object and Error on Swissmedic Job.
  • Debug Encoding error of swissemidcinfo job on production.

Commit

Index


Search broken Objects

Debug strange broken Sequence on production server.

Plugin: ODDB::SwissmedicPlugin
Error: NoMethodError
Message: undefined method `export_flag' for :@odba_observers:Symbol
Backtrace:
/var/www/oddb.org/src/plugin/swissmedic.rb:98:in `block (2 levels) in
set_all_export_flag_false'
/var/www/oddb.org/src/plugin/swissmedic.rb:97:in `each'
/var/www/oddb.org/src/plugin/swissmedic.rb:97:in `block in
set_all_export_flag_false'

src/plugin/swissmedic.rb

    def set_all_export_flag_false
      @app.each_registration do |reg|
        # registration export_flag
        @known_export_registrations += 1 if reg.export_flag
        @app.update reg.pointer, {:export_flag => false}, :admin
        # sequence export_flag
        reg.sequences.values.each do |seq|
          @known_export_sequences += 1 if seq.export_flag
          @app.update seq.pointer, {:export_flag => false}, :admin
        end
      end 
    end

Connection from Registration.

ch.oddb> registrations.values.select{|reg| !reg.sequences.values.select{|seq| !seq.respond_to?(:export_flag)}.empty? }.length
-> 1
ch.oddb> registrations.values.select{|reg| !reg.sequences.values.select{|seq| !seq.respond_to?(:export_flag)}.empty? }.first.sequences.values.first.class
-> Symbol

# delete
ch.oddb> reg = registrations.values.select{|reg| !reg.sequences.values.select{|seq| seq.class != ODDB::Sequence}.empty? }.first; reg.sequences.delete(reg.sequences.first); reg.instance_variable_set('@sequences', {}); reg.odba_store; self.registrations.odba_store; reg.odba_id
-> 27993
ch.oddb> ODBA.cache.fetch(27993)
-> #<ODDB::Registration:0x00000009de54c8>
ch.oddb> ODBA.cache.fetch(27993).sequences
-> []
ch.oddb> ODBA.cache.fetch(27993).instance_variable_set('@sequences', {})
-> {}
ch.oddb> ODBA.cache.fetch(27993).sequences.class
-> Hash
ch.oddb> ODBA.cache.fetch(27993).odba_isolated_store
-> #<ODDB::Registration:0x00000009de54c8>

ch.oddb> registrations.values.select{|reg| !reg.sequences.values.select{|seq| seq.class != ODDB::Sequence}.empty? }.length
-> 0

invalid Sequence and Registration

ch.oddb> packages.length
-> undefined method `packages' for :@odba_observers:Symbol
ch.oddb> active_packages.length
-> undefined method `active?' for []:Array
ch.oddb> sequences.values.select{|seq| !seq.is_a? ODDB::Sequence }.length
-> 1

# still broken (strange)
ch.oddb> registrations.values.select{|reg| !reg.sequences.respond_to?(:values) }.first.sequences.class
-> Hash
ch.oddb> registrations.values.select{|reg| !reg.sequences.respond_to?(:values) }.first.sequences.keys
-> undefined method `keys' for nil:NilClass
ch.oddb> registrations.values.select{|reg| !reg.sequences.respond_to?(:values) }.first.sequences.values
-> undefined method `values' for nil:NilClass

# delete
ch.oddb> ODBA.cache.fetch(27993).odba_delete
-> #<ODDB::Registration:0x00000009c4d408>

ch.oddb> registrations.values.select{|reg| !reg.sequences.values.select{|seq| seq.class != ODDB::Sequence}.empty? }.length
-> 0

src/model/sequence.rb

    def active?
      (!@inactive_date || (@inactive_date > @@two_years_ago)) \
        && @registration && @registration.active? && !violates_patent?
    end

Does create Swissmedic Job this invaild Registration and Sequence ?
Debug these methods.

  • SwissmedicPlugin#update_registration
  • SwissmedicPlugin#update_sequence
  • SwissmedicPlugin#update_packgae
Plugin: ODDB::SwissmedicPlugin
Error: NoMethodError
Message: undefined method `data_origin' for []:Array
Backtrace:
/var/ch.oddb.org/.bundle/gems/ruby/1.9.1/gems/odba-1.0.8/lib/odba/stub.rb:112:in `method_missing'
/var/ch.oddb.org/src/plugin/swissmedic.rb:460:in `block in rows_diff'
/var/ch.oddb.org/src/plugin/swissmedic.rb:457:in `select'
/var/ch.oddb.org/src/plugin/swissmedic.rb:457:in `rows_diff'
/var/ch.oddb.org/.bundle/gems/ruby/1.9.1/gems/swissmedic_diff-0.1.3/lib/swissmedic-diff.rb:137:in `block in diff'
ch.oddb> packages.values.select{|pac| pac.registration.is_a?(Array) }.length
-> undefined method `registration' for :@odba_persistent:Symbol
ch.oddb> packages.values.select{|pac| !pac.is_a?(ODDB::Package) }.length
-> 12
ch.oddb> packages.values.select{|pac| !pac.is_a?(ODDB::Package) }.first
-> @odba_persistent
ch.oddb> packages.values.select{|pac| !pac.is_a?(ODDB::Package) }.first.class
-> Symbol

Strange Sequence has invalid Package.

ch.oddb> registrations.values.select{|reg| !reg.packages.select{|pac| !pac.is_a?(ODDB::Package) }.empty? }.first.packages.select{|pac| !pac.is_a?(ODDB::Package) }.length
-> 12
ch.oddb> registrations.values.select{|reg| !reg.packages.select{|pac| !pac.is_a?(ODDB::Package) }.empty? }.first.sequences.values.select{|seq| !seq.packages.values.select{|pac| !pac.is_a?(ODDB::Package) }.empty? }.length
-> 1

These invalid Sequence, Registration does not have Observer Methods.
Then I could not delete connections.

# delete
ch.oddb> registrations.values.select{|reg| !reg.packages.select{|pac| !pac.is_a?(ODDB::Package) }.empty? }.first.sequences.values.select{|seq| !seq.packages.values.select{|pac| !pac.is_a?(ODDB::Package) }.empty? }.first.odba_delete 

ch.oddb> registrations.values.select{|reg| !reg.packages.select{|pac| !pac.is_a?(ODDB::Package) }.empty? }
-> []
  • 55829
  • 5582803

Debug swissmedic job

NoMethodError: undefined method `fachinfo' for nil:NilClass when updating index 'fachinfo_index_de' with a ODDB::AtcClass
["(eval):2:in `block (2 levels) in proc_instance_origin'", "(eval):2:in `collect'", "(eval):2:in `block in proc_instance_origin'", "/ch.oddb.org/.bundle/gems/ruby/1.9.1/gems/odba-1.0.8/lib/odba/index.rb:202:in `call'"]
[...]

NoMethodError: undefined method `fachinfo' for []:Array when updating index 'interactions_index_de' with a ODDB::Sequence
["(eval):2:in `block in proc_instance_origin'"
...

NoMethodError: undefined method `fachinfo' for nil:NilClass when updating index 'unwanted_effects_index_de' with a ODDB::Sequence
["(eval):2:in `block in proc_instance_origin'"
...

Debug-swissmedicinfo-job

Encoding error

Plugin: ODDB::TextInfoPlugin
Error: ArgumentError
Message: invalid byte sequence in US-ASCII
Backtrace:
/var/www/oddb.org/src/plugin/text_info.rb:899:in `extract_image'
/var/www/oddb.org/src/plugin/text_info.rb:946:in `block in parse_end_update'
/var/www/oddb.org/src/plugin/text_info.rb:920:in `each'
/var/www/oddb.org/src/plugin/text_info.rb:920:in `parse_end_update'
/var/www/oddb.org/src/plugin/text_info.rb:995:in `block (3 levels) in
import_swissmedicinfo'
...
commit

index error

ERROR:  index row size 6672 exceeds maximum 2712 for index "search_term_fachinfo_name_de"
HINT:  Values larger than 1/3 of a buffer page cannot be indexed.
Consider a function index of an MD5 hash of the value, or use full text indexing.

DBI::ProgrammingError: ERROR:  index row size 6672 exceeds maximum 2712 for index "search_term_fachinfo_name_de"
HINT:  Values larger than 1/3 of a buffer page cannot be indexed.
Consider a function index of an MD5 hash of the value, or use full text indexing.
 when updating index 'fachinfo_name_de' with a ODDB::Fachinfo

broken object

NoMethodError: undefined method `values' for nil:NilClass when updating index 'sequence_vaccine' with a ODDB::Registration
["(eval):2:in `block in proc_instance_target'",

NOTE

INDEX table on PostgreSQL

oddb.org.ruby193=# \d fachinfo_name_de
  Table "public.fachinfo_name_de"
   Column    |  Type   | Modifiers 
-------------+---------+-----------
 origin_id   | integer | 
 search_term | text    | 
 target_id   | integer | 
Indexes:
    "origin_id_fachinfo_name_de" btree (origin_id)
    "search_term_fachinfo_name_de" btree (search_term)
    "target_id_fachinfo_name_de" btree (target_id)

view · edit · sidebar · attach · print · history
Page last modified on March 11, 2013, at 10:13 AM