could not connect to www.swissreg.ch: #<Net::HTTPInternalServerError:0x007f8a7d69bb58>
---
This error has been seen. It looks like
Plugin: ODDB::TextInfoPlugin Error: DBI::ProgrammingError Message: FEHLER: vorbereitete Anweisung »ruby-dbi:Pg:978531601391587626.205986« existiert bereits > Backtrace: /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/dbd-pg-0.3.9/lib/dbd/pg/statement.rb:62:in `rescue in execute' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/dbd-pg-0.3.9/lib/dbd/pg/statement.rb:37:in `execute' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/bundler/gems/ruby-dbi-dcd6239fd5f8/lib/dbi/base_classes/database.rb:96:in `execute' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/bundler/gems/ruby-dbi-dcd6239fd5f8/lib/dbi/handles/database.rb:81:in `execute' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/bundler/gems/ruby-dbi-dcd6239fd5f8/lib/dbi/handles/database.rb:128:in `select_all' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/connection_pool.rb:39:in `block in method_missing' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/connection_pool.rb:29:in `next_connection' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/connection_pool.rb:38:in `method_missing' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/storage.rb:508:in `restore_collection' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:236:in `fetch_collection' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:632:in `restore' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:318:in `block in fetch_or_restore' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:313:in `call' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:313:in `fetch_or_do' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:317:in `fetch_or_restore' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:65:in `block in bulk_restore' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:62:in `each' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:62:in `bulk_restore' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:56:in `bulk_fetch' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:260:in `fetch_collection' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:632:in `restore' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:318:in `block in fetch_or_restore' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:313:in `call' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:313:in `fetch_or_do' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:317:in `fetch_or_restore' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:640:in `restore_object' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:605:in `load_object' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:226:in `block in fetch' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:313:in `call' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:313:in `fetch_or_do' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:225:in `fetch' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:49:in `odba_receiver' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:112:in `method_missing' /var/www/oddb.org/src/util/oddbapp.rb:218:in `clean_invoices' /var/www/oddb.org/src/util/oddbapp.rb:1469:in `clean' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/sbsm-1.2.3/lib/sbsm/drbserver.rb:140:in `block (3 levels) in run_cleaner' <internal:prelude>:10:in `synchronize' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/sbsm-1.2.3/lib/sbsm/drbserver.rb:139:in `block (2 levels) in run_cleaner' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/sbsm-1.2.3/lib/sbsm/drbserver.rb:137:in `loop' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/sbsm-1.2.3/lib/sbsm/drbserver.rb:137:in `block in run_cleaner'
Verified that the content of the dbi-gem is the same as bundle and in the previous version.
diff -r /usr/local/lib64/ruby/gems/1.9.1/gems/dbi-0.4.5 /var/www/oddb.org/vendor/bundle/ruby/1.9.1/bundler/gems/ruby-dbi-dcd6239fd5f8/ diff -r /usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/ /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/odba-1.1.0 diff -r /usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/ /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/sbsm-1.2.3
Found an explanation on http://stackoverflow.com/questions/13967333/prepared-statements-already-exists
Looking at the code of the odba gem in lib/odba/storage.rb I see that is uses the Ruby-Object-ID as ID for the prepared statement. I think that leaves open the following possibilites for collision
E.g. I think that in odba/lib/odba/storage.rb the ensure_object_connections method should ensue that the finish method is called. Eg. this patch might work.
diff --git a/lib/odba/storage.rb b/lib/odba/storage.rb index c8c135b..9a0dcf4 100644 --- a/lib/odba/storage.rb +++ b/lib/odba/storage.rb @@ -262,6 +262,7 @@ CREATE INDEX target_id_#{table_name} ON #{table_name}(target_id); update_ids.each { |id| sth.execute(origin_id, id) } + ensure sth.finish end def ensure_target_id_index(table_name)
As Zeno remarked that Ruby 1.9.3p484 does not behave exactly the same as on the Ruby 1.9.3p0 on thinpower I installed locally with
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.bz2 tar -jxf ruby-1.9.3-p0.tar.bz2 cd ruby-1.9.3-p0/ ./configure make sudo make install ruby -v ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
Applied the patches for csv.rb and rexml/source.rb. (I think the other patches are not needed anymore).
Ran in bin/admin
ch.oddb> inject_poweruser 'niklaus.giger@hispeed.ch', 'top_secret', 36000 -> undefined method `add_invoice' for #<NameError: uninitialized constant ODDB::PowerUser>
Cannot test a small fix as import_daily is still running and I don't want to interrupt it now. Removing the call to add_invoice does not help and after re-issuing the command on bin/admin I see the following error on the bin/oddbd output.
failsafe rescued NameError < StandardError uninitialized constant ODDB::PowerUser /var/www/oddb.org/src/util/oddbapp.rb:433:in `create_poweruser' /var/www/oddb.org/src/util/persistence.rb:216:in `issue_create' /var/www/oddb.org/src/util/oddbapp.rb:108:in `block in create' /var/www/oddb.org/src/util/failsafe.rb:10:in `call' /var/www/oddb.org/src/util/failsafe.rb:10:in `failsafe' /var/www/oddb.org/src/util/oddbapp.rb:107:in `create' /var/www/oddb.org/src/util/persistence.rb:288:in `block in resolve' /var/www/oddb.org/src/util/persistence.rb:278:in `each' /var/www/oddb.org/src/util/persistence.rb:278:in `resolve' /var/www/oddb.org/src/util/persistence.rb:256:in `issue_update' /var/www/oddb.org/src/util/oddbapp.rb:129:in `block in update' /var/www/oddb.org/src/util/failsafe.rb:10:in `call' /var/www/oddb.org/src/util/failsafe.rb:10:in `failsafe' /var/www/oddb.org/src/util/oddbapp.rb:127:in `update' /var/www/oddb.org/src/util/oddbapp.rb:1529:in `inject_poweruser' (eval):1:in `block (2 levels) in _admin' /var/www/oddb.org/src/util/oddbapp.rb:1580:in `instance_eval' /var/www/oddb.org/src/util/oddbapp.rb:1580:in `block (2 levels) in _admin' /var/www/oddb.org/src/util/failsafe.rb:10:in `call' /var/www/oddb.org/src/util/failsafe.rb:10:in `failsafe' /var/www/oddb.org/src/util/oddbapp.rb:1579:in `block in _admin'
When I created yesterday a package with a bin/admin line, it was impossible to edit the resulting package via the web. I think the easiest way is to add to src/util/oddbapp.rb a new utility method create_empty_package(seq, pack_nr) which bundles all the required steps in one place.
But first I must be able to run yusd on oddb-ci2.dyndns.org (or oddb.dyndns.org) to be able to log in as admin. The yus DB was no more present. Recreated YUS-DB, granted user. Asked for new password. Now logout/login works as before.
My first question is whether I can edit a sequences '000' which are created when adding a new iksnr which is not yet present in the DB. Found the first one with bin/admin
ch.oddb> sequences.find{ |x| x.seqnr = '00'}.iksnr -> 00035
But remarked that we have problems, when trying to find all. E.g
sequences.find_all{ |x| x.seqnr = '00'} -> undefined method `fix_pointers' for #<ODDB::Composition:0x007ffcc4430620> ch.oddb> sequences.find{ |x| x.seqnr = '00' and x.iksnr > '60000'} -> undefined method `fix_pointers' for Lyophilisat: Rötelnvirus Stamm ra 27/3 1000 TC:ODDB::Composition
Is this now the real problem, that the method fix_pointers is not present for newly created sequences '00'? Maybe I just forgot to add a fix_pointers when creating the registration/sequence/package in text_info.rb. E.g looking at src/model/sequence.rb I find the method
def seqnr=(seqnr) ## FIXME: this is just a quick spaghetti-hack to get all data correct if(/^[0-9]{2}$/u.match(seqnr) \ && @registration.sequence(seqnr).nil?) seqs = @registration.sequences seqs.delete(@seqnr) seqs.store(seqnr, self) seqs.odba_store @seqnr = seqnr fix_pointers end end
After runnig the command
registration('56075').sequence('02').package('052').fix_pointers
in bin/admin I get the error @@NoMethodError undefined method `invoiceable?' for false:FalseClass@@ when trying to edit the 052 via http://oddb-ci2.dyndns.org/de/gcc/drug/reg/56075/seq/02/pack/052.
ch.oddb> registration('56075').sequence('02').fix_pointers -> undefined method `fix_pointers' for Schmelztabletten: Mirtazapinum 30 mg:ODDB::Composition ch.oddb> registration('56075').sequence('02').package('058').parts.size -> 1 ch.oddb> registration('56075').sequence('02').package('058').parts.first.fix_pointers -> #<ODDB::Part:0x007ffc994525e8> ch.oddb> registration('56075').sequence('02').fix_pointers -> undefined method `fix_pointers' for Schmelztabletten: Mirtazapinum 30 mg:ODDB::Composition ch.oddb> registration('56075').sequence('02').odba_store -> Remeron SolTab 30 mg, Schmelztabletten
Investigating the source code I did really not find a fix_pointers method for the class composition. Restarted bin/oddbd and revisted http://oddb-ci2.dyndns.org/de/gcc/drug/reg/56075/seq/02/pack/052. Now in bin/oddbd I see the following
ODBA::Stub was unable to replace ODDB::SlEntry#799984 from ODDB::Package:#219678 error in SBSM::Session#to_html: /de/gcc/drug/reg/56075/seq/02/pack/052 NoMethodError undefined method `invoiceable?' for false:FalseClass /var/www/oddb.org/src/view/admin/package.rb:293:in `patinfo_upload' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:68:in `create' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `compose' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:57:in `init' /var/www/oddb.org/src/view/admin/package.rb:224:in `init' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/component.rb:139:in `initialize' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:61:in `new' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:61:in `create' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `compose' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:57:in `init' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/form.rb:82:in `init' /var/www/oddb.org/src/view/admin/package.rb:373:in `init' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/component.rb:139:in `initialize' /var/www/oddb.org/src/view/publictemplate.rb:63:in `new' /var/www/oddb.org/src/view/publictemplate.rb:63:in `content' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:68:in `create' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `compose' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:57:in `init' /var/www/oddb.org/src/view/publictemplate.rb:60:in `init' /var/www/oddb.org/src/view/privatetemplate.rb:17:in `init' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/component.rb:139:in `initialize' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/sbsm-1.2.3/lib/sbsm/state.rb:245:in `new' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/sbsm-1.2.3/lib/sbsm/state.rb:245:in `view' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/sbsm-1.2.3/lib/sbsm/state.rb:181:in `to_html' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/sbsm-1.2.3/lib/sbsm/session.rb:447:in `to_html' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/sbsm-1.2.3/lib/sbsm/session.rb:173:in `block in drb_process' <internal:prelude>:10:in `synchronize' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/sbsm-1.2.3/lib/sbsm/session.rb:171:in `drb_process' /usr/lib64/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block' /usr/lib64/ruby/1.9.1/drb/drb.rb:1508:in `perform' /usr/lib64/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop' /usr/lib64/ruby/1.9.1/drb/drb.rb:1582:in `loop' /usr/lib64/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop' ODDB::View::Admin::PackageForm::COMPONENTS[[2, 9]] in create(patinfo_upload) ODDB::View::Admin::RootPackageComposite::COMPONENTS[[0, 1]] in create(ODDB::View::Admin::PackageForm) ODDB::View::Admin::RootPackage::COMPONENTS[[0, 3]] in create(content) ODBA::Stub was unable to replace ODDB::SlEntry#799984 from ODDB::Package:#219678 error in SBSM::Session#http_headers: /de/gcc/drug/reg/56075/seq/02/pack/052 NoMethodError undefined method `invoiceable?' for false:FalseClass /var/www/oddb.org/src/view/admin/package.rb:293:in `patinfo_upload' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:68:in `create' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose' /var/www/oddb.org/vendor/bundle/ruby/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each'
And indeed bin/admin reports
ch.oddb> registration('56075').invoiceable? -> undefined method `invoiceable?' for #<ODDB::Registration:0x007f9760535878>
We get the same error when clicking on "Neue Packungsgrösse" for the sequence 01 in http://oddb-ci2.dyndns.org/de/gcc/drug/reg/56075/seq/01. It seems that MSD Merck Sharp & Dohme AG
is found twice. Once in http://oddb-ci2.dyndns.org/de/gcc/company/oid/27275421 (with 8 inactive registrations) and then via http://oddb-ci2.dyndns.org/de/gcc/company/oid/31059710 (with 109 aktive registrations)
If you look at http://oddb-ci2.dyndns.org/de/gcc/company/ean/7601001376946 you see quite a few to invalid http://oddb-ci2.dyndns.org/de/gcc/drug/reg/612%25.0 IKSNR. Where do they come from?
The following diff allows one to edit http://oddb-ci2.dyndns.org/de/gcc/drug/reg/56075/seq/02/pack/052
git diff src/view/admin/package.rb diff --git a/src/view/admin/package.rb b/src/view/admin/package.rb index cf2bd1a..4d513fc 100644 --- a/src/view/admin/package.rb +++ b/src/view/admin/package.rb @@ -290,7 +290,8 @@ class PackageForm < HtmlGrid::Composite end end def patinfo_upload(model, session=@session) - if(model.company.invoiceable?) + return unless model.company + if (model.company.invoiceable?) HtmlGrid::InputFile.new(:patinfo_upload, model, @session, self) else PointerLink.new(:e_company_not_invoiceable, model.company, @session, self)
Problem is that there is no packungsgrösse (composition) defined. bin/admin confirms this.
ch.oddb> registration('56075').sequence('02').package('058').compositions -> [Schmelztabletten: Mirtazapinum 30 mg] ch.oddb> registration('56075').sequence('02').package('052').compositions -> []
I was unable to add correct composition to package('052'). But I was able to create inside the sequence('02') a new package('053') and adding there the correct Packungsgrösse.
Therefore I called in bin/admin
registration('56075').sequence('02').package('052').parts.first.fix_pointers registration('56075').sequence('02').package('052').parts.odba_store delete registration('56075').sequence('02').package('052').pointer
Then add the package information via Webinterface Admin-User.
Pushed commit Fix new package size when editing a sequence
Now on thinpower (after pulling the commit and restarting oddbd) we should be able to create a correct package '052' after having it deleted with the command in bin/admin delete registration('56075').sequence('02').package('052').pointer
Therefore I think I must refactor textinfo.rb to use new oddbapp.rb method create_sequence and create_package.