RETS gem GetObject request failing inconsistently - rets

I have a long running rake task that updates MLS data every night. The task first updates listing data, then after all the listings are updated, the pictures are loaded via Rails 5.2 activestorage. The listings get updated just fine over a period of 2-4 hours, but the picture loading will run for 10 to 30 minutes before failing with the same Rets::InvalidIdentifier: Got error code 20402 (Invalid Identifier) error.
This error is coming from the MLS Rets server.
I am using the estately/rets gem and using Suckerpunch to run the task asynchronously. The code that results in the error:
line 156 puts 'Now save the pictures'
157
158 ids.each do |id|
159 p = Listing.find(id)
160 mlsid = p.mlsid
161 photos = client.objects '*', {
162 resource: 'Property',
object_type: 'Photo',
resource_id: mlsid
}
if photos.count < 1
next
end
photos.each_with_index do |photo, index|
p.images.attach(io: StringIO.new(photo.body), filename: "#{p.mlsid}-#{index}.jpg")
end
puts "#{photos.count} images attached to listing_id = #{p.id}"
end # pictures ids.each do
client.logout
and the full error trace below:
I, [2018-06-07T06:26:53.943065 #4] INFO -- : S3 Storage (36.8ms) Uploaded file to key: XWoiiTfSh9LR25zKA8y4tpc8 (checksum: oybNBOCMwYTKqaTO5j5Nuw==)
D, [2018-06-07T06:26:53.944271 #4] DEBUG -- : (1.0ms) BEGIN
D, [2018-06-07T06:26:53.946751 #4] DEBUG -- : ActiveStorage::Blob Create (1.4ms) INSERT INTO "active_storage_blobs" ("key", "filename", "content_type", "metadata", "byte_size", "checksum", "created_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id" [["key", "XWoiiTfSh9LR25zKA8y4tpc8"], ["filename", "09973750-21.jpg"], ["content_type", "image/jpeg"], ["metadata", "{\"identified\":true}"], ["byte_size", 35097], ["checksum", "oybNBOCMwYTKqaTO5j5Nuw=="], ["created_at", "2018-06-07 06:26:53.944514"]]
D, [2018-06-07T06:26:53.950865 #4] DEBUG -- : [ActiveJob] [ActiveStorage::AnalyzeJob] [e18de7a4-86bb-4075-844d-5466801613d0] (1.7ms) BEGIN
D, [2018-06-07T06:26:53.952073 #4] DEBUG -- : (4.7ms) COMMIT
D, [2018-06-07T06:26:53.953379 #4] DEBUG -- : (1.0ms) BEGIN
D, [2018-06-07T06:26:53.953591 #4] DEBUG -- : [ActiveJob] [ActiveStorage::AnalyzeJob] [e18de7a4-86bb-4075-844d-5466801613d0] ActiveStorage::Blob Update (1.6ms) UPDATE "active_storage_blobs" SET "metadata" = $1 WHERE "active_storage_blobs"."id" = $2 [["metadata", "{\"identified\":true,\"width\":180,\"height\":225,\"analyzed\":true}"], ["id", 25654]]
D, [2018-06-07T06:26:53.956386 #4] DEBUG -- : ActiveStorage::Attachment Create (0.9ms) INSERT INTO "active_storage_attachments" ("name", "record_type", "record_id", "blob_id", "created_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["name", "images"], ["record_type", "Listing"], ["record_id", 441544], ["blob_id", 25655], ["created_at", "2018-06-07 06:26:53.954865"]]
D, [2018-06-07T06:26:53.958520 #4] DEBUG -- : [ActiveJob] [ActiveStorage::AnalyzeJob] [e18de7a4-86bb-4075-844d-5466801613d0] (2.7ms) COMMIT
D, [2018-06-07T06:26:53.958787 #4] DEBUG -- : Listing Update (1.3ms) UPDATE "listings" SET "updated_at" = $1 WHERE "listings"."id" = $2 [["updated_at", "2018-06-07 06:26:53.956749"], ["id", 441544]]
I, [2018-06-07T06:26:53.959030 #4] INFO -- : [ActiveJob] [ActiveStorage::AnalyzeJob] [e18de7a4-86bb-4075-844d-5466801613d0] Performed ActiveStorage::AnalyzeJob (Job ID: e18de7a4-86bb-4075-844d-5466801613d0) from Async(default) in 47.95ms
D, [2018-06-07T06:26:53.960650 #4] DEBUG -- : (1.4ms) COMMIT
I, [2018-06-07T06:26:53.961439 #4] INFO -- : [ActiveJob] Enqueued ActiveStorage::AnalyzeJob (Job ID: a9027f11-5ec0-4f0a-96f7-ae999a373395) to Async(default) with arguments: #<GlobalID:0x0000000003645a20 #uri=#<URI::GID gid://schoolsparrow/ActiveStorage::Blob/25655>>
22 images attached to listing_id = 441544
D, [2018-06-07T06:26:53.964406 #4] DEBUG -- : Listing Load (1.4ms) SELECT "listings".* FROM "listings" WHERE "listings"."id" = $1 LIMIT $2 [["id", 441545], ["LIMIT", 1]]
D, [2018-06-07T06:26:53.965427 #4] DEBUG -- : ActiveStorage::Blob Load (1.1ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 LIMIT $2 [["id", 25655], ["LIMIT", 1]]
I, [2018-06-07T06:26:53.966994 #4] INFO -- : [ActiveJob] [ActiveStorage::AnalyzeJob] [a9027f11-5ec0-4f0a-96f7-ae999a373395] Performing ActiveStorage::AnalyzeJob (Job ID: a9027f11-5ec0-4f0a-96f7-ae999a373395) from Async(default) with arguments: #<GlobalID:0x00000000035480a0 #uri=#<URI::GID gid://schoolsparrow/ActiveStorage::Blob/25655>>
D, [2018-06-07T06:26:54.003064 #4] DEBUG -- : [ActiveJob] [ActiveStorage::AnalyzeJob] [a9027f11-5ec0-4f0a-96f7-ae999a373395] (0.9ms) BEGIN
D, [2018-06-07T06:26:54.005782 #4] DEBUG -- : [ActiveJob] [ActiveStorage::AnalyzeJob] [a9027f11-5ec0-4f0a-96f7-ae999a373395] ActiveStorage::Blob Update (1.3ms) UPDATE "active_storage_blobs" SET "metadata" = $1 WHERE "active_storage_blobs"."id" = $2 [["metadata", "{\"identified\":true,\"width\":202,\"height\":225,\"analyzed\":true}"], ["id", 25655]]
D, [2018-06-07T06:26:54.012433 #4] DEBUG -- : [ActiveJob] [ActiveStorage::AnalyzeJob] [a9027f11-5ec0-4f0a-96f7-ae999a373395] (6.0ms) COMMIT
I, [2018-06-07T06:26:54.012766 #4] INFO -- : [ActiveJob] [ActiveStorage::AnalyzeJob] [a9027f11-5ec0-4f0a-96f7-ae999a373395] Performed ActiveStorage::AnalyzeJob (Job ID: a9027f11-5ec0-4f0a-96f7-ae999a373395) from Async(default) in 45.53ms
rake aborted!
Rets::InvalidIdentifier: Got error code 20402 (Invalid Identifier)
/app/vendor/bundle/ruby/2.3.0/gems/rets-0.11.0/lib/rets/parser/error_checker.rb:33:in `check'
/app/vendor/bundle/ruby/2.3.0/gems/rets-0.11.0/lib/rets/parser/multipart.rb:35:in `check_for_invalids_parts!'
/app/vendor/bundle/ruby/2.3.0/gems/rets-0.11.0/lib/rets/parser/multipart.rb:29:in `parse'
/app/vendor/bundle/ruby/2.3.0/gems/rets-0.11.0/lib/rets/client.rb:216:in `create_parts_from_response'
/app/vendor/bundle/ruby/2.3.0/gems/rets-0.11.0/lib/rets/client.rb:203:in `objects'
/app/app/jobs/mred_job.rb:162:in `block in perform'
/app/app/jobs/mred_job.rb:159:in `each'
/app/app/jobs/mred_job.rb:159:in `perform'
/app/lib/tasks/update.rake:10:in `update_mred'
/app/lib/tasks/update.rake:6:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `load'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:27:in `run'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli.rb:360:in `exec'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor.rb:369:in `dispatch'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli.rb:20:in `dispatch'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/base.rb:444:in `start'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli.rb:10:in `start'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/exe/bundle:30:in `block in <top (required)>'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/exe/bundle:22:in `<top (required)>'
/app/bin/bundle:3:in `load'
/app/bin/bundle:3:in `<main>'
Tasks: TOP => update:mred
Does anyone have an idea about why this is works for a while, then crashes with the same error? Any thoughts would be much appreciated!

I ended up solving this question by adding an error rescue around the RETS query like this:
begin
photos = client.objects '*', {
resource: 'Property',
object_type: 'Photo',
resource_id: mlsid
}
rescue => e
puts 'Error: ' + e.message
next
end

Try changing the request ID. There is a change both Listing ID and Listing Key field will be available for a MLS. Depends on MLS it may take either one, to extract the image.
Please have look into this document. It says,
If the server does not support UID for the requested type of objects and the client submits a UID instead of the ID, the server MUST respond with
an error. The preferred error code is 20403: No Object Found. Servers that do not implement the PostObject functionality (Section 13) MAY
respond with a 20402: Invalid Identifier. If the requested type of object has an ObjectData class linked in the metadata, the server MUST support
this argument
Hope this will help.

Related

Ignore INVALID HANDLE error in AppVerifier?

I have a VerifierDlls installed against an 3rd-party application. It kept getting crash due to invalid handle error:
APPLICATION_VERIFIER_HANDLES_INVALID_HANDLE (300)
Invalid handle exception for current stack trace.
This stop is generated if the function on the top of the stack passed an
invalid handle to system routines. Usually a simple kb command will reveal
what is the value of the handle passed (must be one of the parameters -
usually the first one). If the value is null then this is clearly wrong.
If the value looks ok you need to use !htrace debugger extension to get a
history of operations pertaining to this handle value. In most cases it
must be that the handle value is used after being closed.
Arguments:
Arg1: 00000000c0000008, Exception code.
Arg2: 0000008397afefd0, Exception record. Use .exr to display it.
Arg3: 0000008397afe9a0, Context record. Use .cxr to display it.
Arg4: 0000000000000000, Not used.
I'm wondering if there's a way to avoid it? I tried to hook CloseHandle and I don't know how to tell if the handle is invalid.
From procdump I can tell CloseHandle was the cause
00 00007ffd`cc963851 : 00000000`00000000 00000000`00000000 0000ab17`238a5e24 00000000`00000002 : ntdll!NtWaitForMultipleObjects+0x14
01 00007ffd`cc962ae5 : 00000000`000016d8 00000000`00000000 00000000`000016d8 00000000`00001000 : ntdll!WerpWaitForCrashReporting+0x6d
02 00007ffd`cc961b97 : 00000000`00000000 00000099`fecfd5c0 00000000`00000020 00007ffd`cc98d68a : ntdll!RtlReportExceptionHelper+0x269
03 00007ffd`ad70ecc1 : 00000099`fecfce60 00000000`00000300 00000223`d06f4280 00000000`00000000 : ntdll!RtlReportException+0x77
04 00007ffd`cc9b5eb0 : 00000000`00000000 00007ffd`cca9b5e0 00000223`d06f4280 00000223`d06f4280 : verifier!AVrfpVectoredExceptionHandler+0x2b1
05 00007ffd`cc98fa3b : 00000099`fecfdab0 00000099`fecfd5c0 00000000`00000000 00000000`deff7850 : ntdll!RtlpCallVectoredHandlers+0x104
06 00007ffd`cc9f960a : 00000000`00000000 00000000`00000000 00007ffd`ad735ef0 00000000`00000000 : ntdll!RtlDispatchException+0x6b
07 00007ffd`ad7067ea : 00007ffd`ad735ef0 00000000`00000000 00007ffd`ad728744 00007ffd`ad73dd40 : ntdll!KiUserExceptionDispatch+0x3a
08 00007ffd`ad70ec59 : 00000099`fecfe130 00000000`00000000 00000223`d06f4280 00000099`fecffd20 : verifier!VerifierStopMessageEx+0x6e2
09 00007ffd`cc9b5eb0 : 00000000`00000000 00007ffd`cca9b5e0 00000223`d06f4280 00000223`d06f4280 : verifier!AVrfpVectoredExceptionHandler+0x249
0a 00007ffd`cc98fa3b : 00000099`fecff090 00000099`fecfea60 00000223`d06d0000 00000000`deff7850 : ntdll!RtlpCallVectoredHandlers+0x104
0b 00007ffd`cc991a59 : 00000099`fecfe9c0 00000000`00000024 00000099`fecfe900 00007ffd`ccaa7870 : ntdll!RtlDispatchException+0x6b
0c 00007ffd`cc9f967a : 00000000`00000000 00000000`000007ac 00007ff6`8b94d3f3 00007ffd`cc9f5bd0 : ntdll!RtlRaiseException+0x2d9
0d 00007ffd`ad71e0e1 : 00000223`d43b1660 00007ffd`cb024700 00007ff6`8b94d3f3 00000000`000007ac : ntdll!KiRaiseUserExceptionDispatcher+0x3a
0e 00007ffd`c94d6d82 : 00000000`000007ac 00000223`d43b1660 00000223`d028e040 00000223`d028e040 : verifier!AVrfpNtClose+0x51
0f 00007ffd`ad7201ad : 00000000`000007ac 00000099`fecff310 00000223`d028e038 00000000`000007ac : KERNELBASE!CloseHandle+0x62
10 00007ffd`ad720218 : 00000000`00000000 00000223`d028e038 00000000`00000000 00000000`00000000 : verifier!AVrfpCloseHandleCommon+0xa1
11 00007ff6`8b94d3f3 : 00000223`d0742fb0 00000099`fecff310 00000223`d028e038 00000000`00000000 : verifier!AVrfpKernel32CloseHandle+0x28
Any ideas?
You can disable single application verifier checks. Run appverif (note there is a 64 and a 32 bit version) and locate the general type of error you have, like
Now comes the not very intuitive action: do a right click on that checkbox and choose "Verifier Stop Options"
You can then select stop option 300 (which is yours) and change the behavior. I don't know exactly what that does, since I never used it, but it sounds either "Ignore" or "Inactive" would be a good choice to get rid of them.
Don't forget to hit the "Save" button after closing the dialog.
The Settings will be stored in Registry somewhere below HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ (64 bit)

Replacing translations using ActiveAdmin

I'm trying to use Mobility in my Rails application with ActiveAdmin as administration panel.
I use Container backend with JSONB column.
I also have activeadmin_json_editor gem installed so it's not possible to produce bad JSON. Inside my admin resource I permit :translations attribute using StrongParams.
When editing translations using ActiveAdmin and submitting the form I get the following parameters:
2.5.3 (#<Admin::QuestionsController:0x00007fd466a9a690>):0 > permitted_params
=> <ActionController::Parameters {"utf8"=>"✓", "_method"=>"patch", "authenticity_token"=>"DwSuN9M9cD27dR7WmitBSMKKgVjhW1om3xwxOJUhK41no8RWH1Xh6L9QNIhOc1NhPYtm5QnKJWh7KEIUvuehUQ==", "commit"=>"Update Question", "id"=>"37", "question"=><ActionController::Parameters {"translations"=>"{\"en\":{\"body\":\"dupa\"}}", "dimension_id"=>"6"} permitted: true>} permitted: true>
However once the update query gets processed my model has no translations at all:
2.5.3 (#<Admin::QuestionsController:0x00007fd466a9a690>):0 > resource.update(permitted_params["question"])
(0.4ms) BEGIN
↳ (pry):18
Dimension Load (0.4ms) SELECT "dimensions".* FROM "dimensions" WHERE "dimensions"."id" = $1 LIMIT $2 [["id", 6], ["LIMIT", 1]]
↳ (pry):18
(0.3ms) COMMIT
↳ (pry):18
=> true
2.5.3 (#<Admin::QuestionsController:0x00007fd466a9a690>):0 > resource
=> #<Question:0x00007fd45c284d98
id: 37,
body: nil,
translations: {},
created_at: Wed, 16 Jan 2019 12:17:38 UTC +00:00,
updated_at: Fri, 08 Feb 2019 12:07:00 UTC +00:00,
dimension_id: 6>
What am I doing wrong? Should I parse the JSON from the params and use resource.<attribute_name>_backend.write for each locale?
Since I didn't get any answers I dug around and came up with the following solution. In your resource admin model add:
controller do
def update
translations = JSON.parse(permitted_params.dig(resource.class.name.downcase, "translations"))
translations.each do |locale, attributes|
supported_attributes = attributes.select { |attribute_name, _| resource.class.mobility_attributes.include?(attribute_name) }
supported_attributes.each do |attribute_name, translation|
resource.send("#{attribute_name}_backend").send(:write, locale.to_sym, translation.to_s)
end
end
resource.save
redirect_to admin_questions_path
end
end
This is probably not really the proper way to mass update the translations but I couldn't figure out a better way to do this. Please keep in mind that this doesn't really care if the locale key is valid.

New record not appearing in elastic search result

Just after creating new record, new record not appearing in listing api although it is getting indexed. New record is appearing when hitting index api again. Using elastic search, implemented through searchkick. Anyone faced this issue?
Started POST "/api/v1/pm/projects/4/meetings" for 127.0.0.1 at 2018-10-12 13:15:45 +0530
Processing by Api::V1::Pm::MeetingsController#create as JSON
Parameters: {"meeting"=>{"name"=>"prj 4 meeting 78", "date"=>"12/10/2018", "start_time"=>"01:30 PM", "end_time"=>"02:00 PM", "url"=>"https://asdf.com", "agenda"=>"prj 4 meeting 78 agenda", "notes"=>"", "members"=>["abc#gmail.com"]}, "project_id"=>"4"}
AuthenticationToken Load (0.2ms) SELECT "authentication_tokens".* FROM "authentication_tokens" WHERE "authentication_tokens"."body" = $1 LIMIT $2 [["body", "Eu5fwDmEkLDootjzE3kcUrGi"], ["LIMIT", 1]]
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 AND "users"."is_approved" = $2 AND "users"."is_archived" = $3 LIMIT $4 [["id", 1], ["is_approved", "t"], ["is_archived", "f"], ["LIMIT", 1]]
Partner Load (0.2ms) SELECT "partners".* FROM "partners" WHERE "partners"."code" = $1 LIMIT $2 [["code", "e-ai"], ["LIMIT", 1]]
Project Load (0.6ms) SELECT "projects".* FROM "projects" WHERE "projects"."id" = $1 LIMIT $2 [["id", 4], ["LIMIT", 1]]
(0.2ms) BEGIN
SQL (1.7ms) INSERT INTO "meetings" ("name", "date", "start_time", "end_time", "url", "agenda", "notes", "members", "project_id", "user_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) RETURNING "id" [["name", "prj 4 meeting 78"], ["date", "2018-10-12"], ["start_time", "13:30:00"], ["end_time", "14:00:00"], ["url", "https://asdf.com"], ["agenda", "prj 4 meeting 78 agenda"], ["notes", ""], ["members", "{abc#gmail.com}"], ["project_id", 4], ["user_id", 1], ["created_at", "2018-10-12 07:45:45.133414"], ["updated_at", "2018-10-12 07:45:45.133414"]]
(10.7ms) COMMIT
***Meeting Store (77.8ms) {"id":78}***
[active_model_serializers] Rendered ActiveModel::Serializer::Null with Hash (1.81ms)
Completed 200 OK in 116ms (Views: 3.5ms | Searchkick: 77.8ms | ActiveRecord: 13.9ms)
Started GET "/api/v1/pm/projects/4/meetings" for 127.0.0.1 at 2018-10-12 13:15:45 +0530
Processing by Api::V1::Pm::MeetingsController#index as JSON
Parameters: {"project_id"=>"4", "meeting"=>{}}
AuthenticationToken Load (0.3ms) SELECT "authentication_tokens".* FROM "authentication_tokens" WHERE "authentication_tokens"."body" = $1 LIMIT $2 [["body", "Eu5fwDmEkLDootjzE3kcUrGi"], ["LIMIT", 1]]
User Load (1.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 AND "users"."is_approved" = $2 AND "users"."is_archived" = $3 LIMIT $4 [["id", 1], ["is_approved", "t"], ["is_archived", "f"], ["LIMIT", 1]]
Partner Load (1.0ms) SELECT "partners".* FROM "partners" WHERE "partners"."code" = $1 LIMIT $2 [["code", "e-ai"], ["LIMIT", 1]]
Project Load (0.6ms) SELECT "projects".* FROM "projects" WHERE "projects"."id" = $1 LIMIT $2 [["id", 4], ["LIMIT", 1]]
Meeting Search (16.8ms) curl http://localhost:9200/meetings_development/_search?pretty -H 'Content-Type: application/json' -d '{"query":{"bool":{"must":{"match_all":{}},"filter":[{"term":{"project_id":4}}]}},"sort":{"cancelled_at":{"order":"asc","unmapped_type":"boolean"},"updated_at":{"order":"desc","unmapped_type":"long"}},"timeout":"11s","_source":false,"size":25,"from":0}'
Meeting Load (1.8ms) SELECT "meetings".* FROM "meetings" WHERE "meetings"."id" IN (77, 75, 76, 74, 73, 72, 71, 70)
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1
[active_model_serializers] Rendered ActiveModel::Serializer::Null with Hash (13.02ms)
Completed 200 OK in 52ms (Views: 14.4ms | Searchkick: 16.8ms | ActiveRecord: 5.5ms)
As you can see in logs meeting with id 78 is getting indexed but not appearing in index api.
Elasticsearch is Near Realtime (NRT) search platform. What this means
is there is a slight latency (normally one second) from the time you
index a document until the time it becomes searchable. NRT
If you can use bulk API instead as it is faster in indexing than one record by time.
For example, the update settings API can be used to dynamically change
the index from being more performant for bulk indexing, and then move
it to more real time indexing state. Before the bulk indexing is
started, use:
PUT /twitter/_settings
{
"index" : {
"refresh_interval" : "-1"
}
}
check the docs. refresh_interval
and see this discussion discussion

Why does Mechanize HTML content print <!-- Session expired -->?

I want to login to my bank account with Mechanize (2.7.3) and print out the current balance.
But after successful login something's not quite right because Mechanize is not showing the correct information that's supposed to be on the page.
The output is interesting. Especially the <!-- Session expired --> part.
Here's the code I'm using:
require 'mechanize'
require 'logger'
# Instantiate a new Mechanize object
a = Mechanize.new do |agent|
agent.user_agent_alias = 'Mac Safari'
agent.follow_meta_refresh = true
agent.log = Logger.new "mech.log"
end
# Fetch URL with Mechanize
a.get('https://mijn.ing.nl/internetbankieren/SesamLoginServlet') do |page|
login_form = page.forms.first
# Store the randomly generated input names into variables
username_input_name = login_form.fields[0].name
password_input_name = login_form.fields[1].name
# Fill in the username and password form
login_form.field_with(:name => username_input_name).value = 'username'
login_form.field_with(:name => password_input_name).value = 'password'
# Login
dashboard_page = login_form.submit(nil, {'Cookie' => HTTP::Cookie.cookie_value(a.cookie_jar.cookies)})
puts dashboard_page.content
# Check if the login was successfull
puts "=================="
puts check_1 = dashboard_page.title == 'Mijn ING Overzicht - Mijn ING' ? "CHECK 1 LOGIN SUCCESS" : "CHECK 1 LOGIN FAIL"
puts "=================="
end
Here's the console output with a.follow_meta_refresh = true:
<html>
<body>
<!-- Session expired -->
<script>
<!-- Hide script from old browsers
function urlencode(str) {
return escape(str).replace('%3A', ':').replace('+', '%2B').replace('%20', '+').replace('*', '%2A').replace('/', '%2F').replace('#', '%40').replace('%2F', '/');
}
var url_encoded_referrer = urlencode(document.location);
var url = 'https://' + document.location.hostname + '/ssm/sso/login?Target=' + url_encoded_referrer;
window.location = url;
//-- Stop hiding script -->
</script>
</body>
</html>
==================
CHECK 1 LOGIN FAIL
==================
This is the logfile:
# Logfile created on 2013-12-27 09:16:17 +0100 by logger.rb/41954
I, [2013-12-27T09:16:17.112862 #978] INFO -- : Net::HTTP::Get: /internetbankieren/SesamLoginServlet
D, [2013-12-27T09:16:17.112910 #978] DEBUG -- : request-header: accept-encoding => gzip,deflate,identity
D, [2013-12-27T09:16:17.112935 #978] DEBUG -- : request-header: accept => */*
D, [2013-12-27T09:16:17.112957 #978] DEBUG -- : request-header: user-agent => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22
D, [2013-12-27T09:16:17.112978 #978] DEBUG -- : request-header: accept-charset => ISO-8859-1,utf-8;q=0.7,*;q=0.7
D, [2013-12-27T09:16:17.112999 #978] DEBUG -- : request-header: accept-language => en-us,en;q=0.5
D, [2013-12-27T09:16:17.113019 #978] DEBUG -- : request-header: host => mijn.ing.nl
I, [2013-12-27T09:16:17.678728 #978] INFO -- : status: Net::HTTPOK 1.1 200 OK
D, [2013-12-27T09:16:17.678787 #978] DEBUG -- : response-header: date => Fri, 27 Dec 2013 08:16:17 GMT
D, [2013-12-27T09:16:17.678813 #978] DEBUG -- : response-header: cache-control => no-cache, no-store
D, [2013-12-27T09:16:17.678834 #978] DEBUG -- : response-header: pragma => no-cache
D, [2013-12-27T09:16:17.678855 #978] DEBUG -- : response-header: expires => Thu, 01 Jan 1970 00:00:00 GMT
D, [2013-12-27T09:16:17.678877 #978] DEBUG -- : response-header: set-cookie => sessiontype=mpb; Secure, aac=332016DB0A85C1245596211F7D403A78; Expires=Sat, 27 Dec 2014 08:16:17 GMT; Domain=.ing.nl; Secure, internetbankierenmi=1575004352.20480.0000; path=/, TS765584=312694932a75764058a09928f7990ca23a092c849a2d804452bd3751d4efbe89959deba9debace3fc06c3994e27e0b6b0f2fcdc7; Path=/
D, [2013-12-27T09:16:17.678900 #978] DEBUG -- : response-header: vary => Accept-Encoding,User-Agent
D, [2013-12-27T09:16:17.678921 #978] DEBUG -- : response-header: content-encoding => gzip
D, [2013-12-27T09:16:17.678942 #978] DEBUG -- : response-header: keep-alive => timeout=90, max=1000
D, [2013-12-27T09:16:17.678962 #978] DEBUG -- : response-header: connection => Keep-Alive
D, [2013-12-27T09:16:17.678983 #978] DEBUG -- : response-header: content-type => text/html;charset=ISO-8859-1
D, [2013-12-27T09:16:17.679003 #978] DEBUG -- : response-header: content-language => en
D, [2013-12-27T09:16:17.679023 #978] DEBUG -- : response-header: transfer-encoding => chunked
D, [2013-12-27T09:16:17.679118 #978] DEBUG -- : Read 10 bytes (10 total)
D, [2013-12-27T09:16:17.679974 #978] DEBUG -- : Read 1443 bytes (1453 total)
D, [2013-12-27T09:16:17.680403 #978] DEBUG -- : Read 1448 bytes (2901 total)
D, [2013-12-27T09:16:17.680469 #978] DEBUG -- : Read 1112 bytes (4013 total)
D, [2013-12-27T09:16:17.680566 #978] DEBUG -- : gzip response
D, [2013-12-27T09:16:17.683042 #978] DEBUG -- : saved cookie: sessiontype=mpb
D, [2013-12-27T09:16:17.683568 #978] DEBUG -- : saved cookie: aac=332016DB0A85C1245596211F7D403A78
D, [2013-12-27T09:16:17.683684 #978] DEBUG -- : saved cookie: internetbankierenmi=1575004352.20480.0000
D, [2013-12-27T09:16:17.683778 #978] DEBUG -- : saved cookie: TS765584=312694932a75764058a09928f7990ca23a092c849a2d804452bd3751d4efbe89959deba9debace3fc06c3994e27e0b6b0f2fcdc7
I, [2013-12-27T09:16:17.685622 #978] INFO -- : form encoding: ISO-8859-1
D, [2013-12-27T09:16:17.685989 #978] DEBUG -- : query: "a8yzXvCb7f5ZKsFaT=n.aramjan&a9jSD_u8G4nO23oXI=EYoss2303"
I, [2013-12-27T09:16:17.686528 #978] INFO -- : Net::HTTP::Post: /internetbankieren/SesamLoginServlet
D, [2013-12-27T09:16:17.686562 #978] DEBUG -- : request-header: accept-encoding => gzip,deflate,identity
D, [2013-12-27T09:16:17.686587 #978] DEBUG -- : request-header: accept => */*
D, [2013-12-27T09:16:17.686609 #978] DEBUG -- : request-header: user-agent => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22
D, [2013-12-27T09:16:17.686631 #978] DEBUG -- : request-header: accept-charset => ISO-8859-1,utf-8;q=0.7,*;q=0.7
D, [2013-12-27T09:16:17.686653 #978] DEBUG -- : request-header: accept-language => en-us,en;q=0.5
D, [2013-12-27T09:16:17.686677 #978] DEBUG -- : request-header: cookie => TS765584=312694932a75764058a09928f7990ca23a092c849a2d804452bd3751d4efbe89959deba9debace3fc06c3994e27e0b6b0f2fcdc7; aac=332016DB0A85C1245596211F7D403A78; internetbankierenmi=1575004352.20480.0000; sessiontype=mpb
D, [2013-12-27T09:16:17.686711 #978] DEBUG -- : request-header: host => mijn.ing.nl
D, [2013-12-27T09:16:17.686739 #978] DEBUG -- : request-header: referer => https://mijn.ing.nl/internetbankieren/SesamLoginServlet
D, [2013-12-27T09:16:17.686760 #978] DEBUG -- : request-header: content-type => application/x-www-form-urlencoded
D, [2013-12-27T09:16:17.686781 #978] DEBUG -- : request-header: content-length => 55
I, [2013-12-27T09:16:18.225851 #978] INFO -- : status: Net::HTTPOK 1.1 200 OK
D, [2013-12-27T09:16:18.225913 #978] DEBUG -- : response-header: date => Fri, 27 Dec 2013 08:16:17 GMT
D, [2013-12-27T09:16:18.225938 #978] DEBUG -- : response-header: x-ci => r=HPHBPNBMP;c=;a=VRRCSL;u=JXWMBKM
D, [2013-12-27T09:16:18.225962 #978] DEBUG -- : response-header: cache-control => no-cache, no-store, no-cache, no-store
D, [2013-12-27T09:16:18.225983 #978] DEBUG -- : response-header: pragma => no-cache, no-cache
D, [2013-12-27T09:16:18.226005 #978] DEBUG -- : response-header: expires => Thu, 01 Jan 1970 00:00:00 GMT
D, [2013-12-27T09:16:18.226030 #978] DEBUG -- : response-header: set-cookie => SESSESSIONID=0000e3Sar84Bz7XlOymbQkge4gX:17s9ivth6; Path=/; Domain=.ing.nl; Secure, iid=VQGIG0Xq3%2BzTjLSPo5YDiw%3D%3D%3Bmss1; Expires=Wed, 26 Feb 2014 08:16:17 GMT; Path=/; Domain=.ing.nl, gsc=m=s; HttpOnly; Path=/; Domain=.mijn.ing.nl; Secure, Session201=HKVCKUYMLURFZQIENENOANWSSNRUERNF051e7e43; HttpOnly; Path=/; Domain=.mijn.ing.nl; Secure, cookiepref=3; Expires=Sat, 27 Dec 2014 08:16:17 GMT; Path=/; Domain=.ing.nl, TS765584=9e3c30b00a5f1162344f71403a543e573a092c849a2d804452bd3751d4efbe89959deba9debace3fc06c3994e27e0b6b0f2fcdc7eccc06cabcea90646ac25a59abcf00af2532f3ca7d510a274552b96c4b433c8b5f6a631185c8cdc8; Path=/
D, [2013-12-27T09:16:18.226053 #978] DEBUG -- : response-header: vary => Accept-Encoding,User-Agent
D, [2013-12-27T09:16:18.226073 #978] DEBUG -- : response-header: content-encoding => gzip
D, [2013-12-27T09:16:18.226094 #978] DEBUG -- : response-header: keep-alive => timeout=90, max=1000
D, [2013-12-27T09:16:18.226115 #978] DEBUG -- : response-header: connection => Keep-Alive
D, [2013-12-27T09:16:18.226139 #978] DEBUG -- : response-header: content-type => text/html;charset=ISO-8859-1
D, [2013-12-27T09:16:18.226159 #978] DEBUG -- : response-header: content-language => en
D, [2013-12-27T09:16:18.226180 #978] DEBUG -- : response-header: transfer-encoding => chunked
D, [2013-12-27T09:16:18.226252 #978] DEBUG -- : Read 326 bytes (326 total)
D, [2013-12-27T09:16:18.226381 #978] DEBUG -- : gzip response
D, [2013-12-27T09:16:18.226730 #978] DEBUG -- : saved cookie: SESSESSIONID=0000e3Sar84Bz7XlOymbQkge4gX:17s9ivth6
D, [2013-12-27T09:16:18.226933 #978] DEBUG -- : saved cookie: iid=VQGIG0Xq3%2BzTjLSPo5YDiw%3D%3D%3Bmss1
D, [2013-12-27T09:16:18.227051 #978] DEBUG -- : saved cookie: gsc=m=s
D, [2013-12-27T09:16:18.227152 #978] DEBUG -- : saved cookie: Session201=HKVCKUYMLURFZQIENENOANWSSNRUERNF051e7e43
D, [2013-12-27T09:16:18.227311 #978] DEBUG -- : saved cookie: cookiepref=3
D, [2013-12-27T09:16:18.227423 #978] DEBUG -- : saved cookie: TS765584=9e3c30b00a5f1162344f71403a543e573a092c849a2d804452bd3751d4efbe89959deba9debace3fc06c3994e27e0b6b0f2fcdc7eccc06cabcea90646ac25a59abcf00af2532f3ca7d510a274552b96c4b433c8b5f6a631185c8cdc8
I, [2013-12-27T09:16:18.230318 #978] INFO -- : Net::HTTP::Get: /particulier/betalen/index
D, [2013-12-27T09:16:18.230355 #978] DEBUG -- : request-header: accept-encoding => gzip,deflate,identity
D, [2013-12-27T09:16:18.230379 #978] DEBUG -- : request-header: accept => */*
D, [2013-12-27T09:16:18.230401 #978] DEBUG -- : request-header: user-agent => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22
D, [2013-12-27T09:16:18.230421 #978] DEBUG -- : request-header: accept-charset => ISO-8859-1,utf-8;q=0.7,*;q=0.7
D, [2013-12-27T09:16:18.230456 #978] DEBUG -- : request-header: accept-language => en-us,en;q=0.5
D, [2013-12-27T09:16:18.230478 #978] DEBUG -- : request-header: cookie => SESSESSIONID=0000e3Sar84Bz7XlOymbQkge4gX:17s9ivth6; Session201=HKVCKUYMLURFZQIENENOANWSSNRUERNF051e7e43; cookiepref=3; gsc=m=s; iid=VQGIG0Xq3%2BzTjLSPo5YDiw%3D%3D%3Bmss1
D, [2013-12-27T09:16:18.230501 #978] DEBUG -- : request-header: host => bankieren.mijn.ing.nl
I, [2013-12-27T09:16:18.714637 #978] INFO -- : status: Net::HTTPOK 1.1 200 OK
D, [2013-12-27T09:16:18.714692 #978] DEBUG -- : response-header: content-length => 506
D, [2013-12-27T09:16:18.714716 #978] DEBUG -- : response-header: content-type => text/html
D, [2013-12-27T09:16:18.714738 #978] DEBUG -- : response-header: date => Fri, 27 Dec 2013 08:16:18 GMT
D, [2013-12-27T09:16:18.714760 #978] DEBUG -- : response-header: p3p => CP="NON CUR OTPi OUR NOR UNI"
D, [2013-12-27T09:16:18.714781 #978] DEBUG -- : response-header: cache-control => no-cache
D, [2013-12-27T09:16:18.714801 #978] DEBUG -- : response-header: pragma => no-cache
D, [2013-12-27T09:16:18.714825 #978] DEBUG -- : response-header: set-cookie => S-SESSION-ID=2_0_nG1XBMZWH2kJdOBjCloZA651nXttTm5wiYowRBYDQY7gxH1L; Path=/; Secure; HttpOnly, lb-4-25a-1=208176394.20480.0000; path=/, TS31e294=06caec21f242b201e4b52847e45a8a475bd58411f71b544852bd3752022ecc54fb717d9b1b4d09a87ea0bb21; Path=/
D, [2013-12-27T09:16:18.714889 #978] DEBUG -- : Read 506 bytes (506 total)
D, [2013-12-27T09:16:18.715236 #978] DEBUG -- : saved cookie: S-SESSION-ID=2_0_nG1XBMZWH2kJdOBjCloZA651nXttTm5wiYowRBYDQY7gxH1L
D, [2013-12-27T09:16:18.715340 #978] DEBUG -- : saved cookie: lb-4-25a-1=208176394.20480.0000
D, [2013-12-27T09:16:18.715437 #978] DEBUG -- : saved cookie: TS31e294=06caec21f242b201e4b52847e45a8a475bd58411f71b544852bd3752022ecc54fb717d9b1b4d09a87ea0bb21
Any ideas? It would be great to solve this on Christmas day!
Double check if cookies are persisted across clicks, and try selenium - it's possible some funny JS stuff is going on that page and selenium would handle it for you (http://rubygems.org/gems/selenium-webdriver)
UPDATE
See this answer for more info on cookie handling in Mechanize: Maintaining cookies between Mechanize requests
Also, try disabling JS in the browser and then log into your bank, make sure everything still works without JS (if it works then great, if not then you need to use a JS-capable driver)
CONCLUSION
Cause in this case was the bank's website, it depends on client-side JavaScript code to function properly so a JS-incapable driver like mechanize won't do. You will need to use one of the JavaScript-capable drivers - most popular of which are selenium, webkit and poltergeist - all decent, but neither really satisfying.
Considering all three require some host-side dependencies (poltergeist least of all though) the "what installs best" might be the prevailing factor in choosing between them.
For a Heroku deployment....
poltergeist does seem to have some issues (websocket related, seems heroku is blocking them) but it's the best bet for heroku deployment https://github.com/jonleighton/poltergeist/issues/194
and for selenium and webkit, quick google shows a number of issues - they seem to require X and/or xvfb, see Is it possible to run capybara-webkit (i.e. forked webkit_server) on Heroku Cedar? and Is there a working nodejs/phantomjs Heroku buildpack? and Running selenium browser on server (Flask/Python/Heroku) for further reading

Copying an Oracle Database to another environment does not work

I am trying to restore a database from one environment to another. I backed up all the files from machineA and copied them to machineB.
The directory structures and file locations of both machines is the same and both are running Oracle 10.2.0.3.0.
I have done this several times before and it has always worked fine but this time i seem to be struggling and i appear to be stuck. After restoring all files into machineB, i startup oracle and it is showing that it has started.
SQL> startup
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2030456 bytes
Variable Size 234882184 bytes
Database Buffers 1358954496 bytes
Redo Buffers 14745600 bytes
Database mounted.
Database opened.
A few minutes later it just terminates. I look at the alert log and this is what it is showing
ALTER DATABASE MOUNT
Wed Nov 23 11:16:14 2011
Setting recovery target incarnation to 1
Wed Nov 23 11:16:14 2011
Successful mount of redo thread 1, with mount id 4202976378
Wed Nov 23 11:16:14 2011
Database mounted in Exclusive Mode
Completed: ALTER DATABASE MOUNT
Wed Nov 23 11:16:14 2011
ALTER DATABASE OPEN
Wed Nov 23 11:16:15 2011
Beginning crash recovery of 1 threads
parallel recovery started with 2 processes
Wed Nov 23 11:16:15 2011
Started redo scan
Wed Nov 23 11:16:15 2011
Completed redo scan
22887 redo blocks read, 29 data blocks need recovery
Wed Nov 23 11:16:15 2011
Started redo application at
Thread 1: logseq 29229, block 72
Wed Nov 23 11:16:15 2011
Recovery of Online Redo Log: Thread 1 Group 3 Seq 29229 Reading mem 0
Mem# 0: /u/db1/app/oracle/oradata/mydb/redo03.log
Wed Nov 23 11:16:15 2011
Completed redo application
Wed Nov 23 11:16:16 2011
Completed crash recovery at
Thread 1: logseq 29229, block 22959, scn 10603747634124
29 data blocks read, 29 data blocks written, 22887 redo blocks read
Wed Nov 23 11:16:17 2011
Thread 1 advanced to log sequence 29230
Thread 1 opened at log sequence 29230
Current log# 1 seq# 29230 mem# 0: /u/db1/app/oracle/oradata/mydb/redo01.log
Successful open of redo thread 1
Wed Nov 23 11:16:17 2011
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Wed Nov 23 11:16:17 2011
SMON: enabling cache recovery
Wed Nov 23 11:16:18 2011
Successfully onlined Undo Tablespace 1.
Wed Nov 23 11:16:18 2011
SMON: enabling tx recovery
Wed Nov 23 11:16:18 2011
Database Characterset is WE8ISO8859P1
Wed Nov 23 11:16:18 2011
Errors in file /u/db1/app/oracle/admin/mydb/bdump/mydb_smon_13515.trc:
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
QMNC started with pid=16, OS id=13532
Wed Nov 23 11:16:20 2011
Doing block recovery for file 2 block 972
Block recovery from logseq 29230, block 56 to scn 10603747634191
Wed Nov 23 11:16:20 2011
Recovery of Online Redo Log: Thread 1 Group 1 Seq 29230 Reading mem 0
Mem# 0: /u/db1/app/oracle/oradata/mydb/redo01.log
Block recovery stopped at EOT rba 29230.66.16
Block recovery completed at rba 29230.66.16, scn 2468.3768347663
Doing block recovery for file 2 block 25
Block recovery from logseq 29230, block 56 to scn 10603747634177
Wed Nov 23 11:16:20 2011
Recovery of Online Redo Log: Thread 1 Group 1 Seq 29230 Reading mem 0
Mem# 0: /u/db1/app/oracle/oradata/mydb/redo01.log
Block recovery completed at rba 29230.58.16, scn 2468.3768347651
Wed Nov 23 11:16:20 2011
Errors in file /u/db1/app/oracle/admin/mydb/bdump/mydb_smon_13515.trc:
ORA-01595: error freeing extent (3) of rollback segment (2))
ORA-00607: Internal error occurred while making a change to a data block
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
Wed Nov 23 11:16:20 2011
Completed: ALTER DATABASE OPEN
Wed Nov 23 11:16:21 2011
Errors in file /u/db1/app/oracle/admin/mydb/bdump/mydb_mmon_13521.trc:
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
Wed Nov 23 11:16:22 2011
Doing block recovery for file 2 block 972
Block recovery from logseq 29230, block 56 to scn 10603747634191
Wed Nov 23 11:16:22 2011
Recovery of Online Redo Log: Thread 1 Group 1 Seq 29230 Reading mem 0
Mem# 0: /u/db1/app/oracle/oradata/mydb/redo01.log
Block recovery completed at rba 29230.66.16, scn 2468.3768347664
Doing block recovery for file 2 block 25
Block recovery from logseq 29230, block 56 to scn 10603747634208
Wed Nov 23 11:16:23 2011
Recovery of Online Redo Log: Thread 1 Group 1 Seq 29230 Reading mem 0
Mem# 0: /u/db1/app/oracle/oradata/mydb/redo01.log
Block recovery completed at rba 29230.88.16, scn 2468.3768347681
Wed Nov 23 11:18:27 2011
Errors in file /u/db1/app/oracle/admin/mydb/bdump/mydb_m000_13538.trc:
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
Wed Nov 23 11:18:28 2011
Flush retried for xcb 0x3ddf94728, pmd 0x3dc32cc30
Doing block recovery for file 2 block 972
Block recovery from logseq 29230, block 56 to scn 10603747634191
Wed Nov 23 11:18:28 2011
Recovery of Online Redo Log: Thread 1 Group 1 Seq 29230 Reading mem 0
Mem# 0: /u/db1/app/oracle/oradata/mydb/redo01.log
Block recovery completed at rba 29230.66.16, scn 2468.3768347664
Wed Nov 23 11:18:28 2011
Errors in file /u/db1/app/oracle/admin/mydb/bdump/mydb_m000_13538.trc:
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
Flush retried for xcb 0x3ddf94728, pmd 0x3dc32cc30
Doing block recovery for file 2 block 972
Block recovery from logseq 29230, block 56 to scn 10603747634191
Wed Nov 23 11:18:30 2011
Recovery of Online Redo Log: Thread 1 Group 1 Seq 29230 Reading mem 0
Mem# 0: /u/db1/app/oracle/oradata/mydb/redo01.log
Block recovery completed at rba 29230.66.16, scn 2468.3768347664
Wed Nov 23 11:18:30 2011
Errors in file /u/db1/app/oracle/admin/mydb/bdump/mydb_m000_13538.trc:
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
Flush retried for xcb 0x3ddf94728, pmd 0x3dc32cc30
Doing block recovery for file 2 block 972
Block recovery from logseq 29230, block 56 to scn 10603747634191
Wed Nov 23 11:18:32 2011
Recovery of Online Redo Log: Thread 1 Group 1 Seq 29230 Reading mem 0
Mem# 0: /u/db1/app/oracle/oradata/mydb/redo01.log
Block recovery completed at rba 29230.66.16, scn 2468.3768347664
Wed Nov 23 11:18:32 2011
Errors in file /u/db1/app/oracle/admin/mydb/bdump/mydb_m000_13538.trc:
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
Flush retried for xcb 0x3ddf94728, pmd 0x3dc32cc30
Doing block recovery for file 2 block 972
Block recovery from logseq 29230, block 56 to scn 10603747634191
Wed Nov 23 11:18:34 2011
Recovery of Online Redo Log: Thread 1 Group 1 Seq 29230 Reading mem 0
Mem# 0: /u/db1/app/oracle/oradata/mydb/redo01.log
Block recovery completed at rba 29230.66.16, scn 2468.3768347664
Wed Nov 23 11:18:34 2011
Errors in file /u/db1/app/oracle/admin/mydb/bdump/mydb_m000_13538.trc:
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-06512: at "SYS.PRVT_ADVISOR", line 4896
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-06512: at line 1
Flush retried for xcb 0x3ddf94728, pmd 0x3dc32cc30
Doing block recovery for file 2 block 972
Block recovery from logseq 29230, block 56 to scn 10603747634191
Wed Nov 23 11:18:35 2011
Recovery of Online Redo Log: Thread 1 Group 1 Seq 29230 Reading mem 0
Mem# 0: /u/db1/app/oracle/oradata/mydb/redo01.log
Block recovery completed at rba 29230.66.16, scn 2468.3768347664
Wed Nov 23 11:18:35 2011
Errors in file /u/db1/app/oracle/admin/mydb/bdump/mydb_m000_13538.trc:
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-06512: at "SYS.PRVT_ADVISOR", line 4896
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
ORA-06512: at line 1
Wed Nov 23 11:18:36 2011
Flush retried for xcb 0x3ddf94728, pmd 0x3dc32cc30
Doing block recovery for file 2 block 972
Block recovery from logseq 29230, block 56 to scn 10603747634191
Wed Nov 23 11:18:36 2011
Recovery of Online Redo Log: Thread 1 Group 1 Seq 29230 Reading mem 0
Mem# 0: /u/db1/app/oracle/oradata/mydb/redo01.log
Block recovery completed at rba 29230.66.16, scn 2468.3768347664
Wed Nov 23 11:18:36 2011
Errors in file /u/db1/app/oracle/admin/mydb/bdump/mydb_pmon_13503.trc:
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
Wed Nov 23 11:18:37 2011
Errors in file /u/db1/app/oracle/admin/mydb/bdump/mydb_pmon_13503.trc:
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
PMON: terminating instance due to error 472
Instance terminated by PMON, pid = 13503
The only difference this time (compared from last time i restored the database) is that this time i cleared the trace files from the bdump directory before i started up the directory(not the alert log). Could this have caused this problem?
Here is an example of one of the trace file mentioned in one of the alert log
/u/db1/app/oracle/admin/ccsbill/bdump/mydb_pmon_13503.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME = /u/db1/app/oracle/product/10.2.0/db
System name: SunOS
Node name: myPC
Release: 5.9
Version: Generic_122300-13
Machine: sun4u
Instance name: mydb
Redo thread mounted by this instance: 1
Oracle process number: 2
Unix process pid: 13503, image: oracle#myPC (PMON)
*** 2011-11-23 11:18:36.626
*** SERVICE NAME:(SYS$BACKGROUND) 2011-11-23 11:18:36.625
*** SESSION ID:(170.1) 2011-11-23 11:18:36.625
Flush retried for xcb 0x3ddf94728, pmd 0x3dc32cc30
DEBUG: Reconstructing undo block 0x8003cc for xcb 0x3ddf94728
Doing block recovery for file 2 block 972
Block header before block recovery:
buffer tsn: 1 rdba: 0x008003cc (2/972)
scn: 0x09a4.e09bc65c seq: 0x01 flg: 0x04 tail: 0xc65c0201
frmt: 0x02 chkval: 0x409e type: 0x02=KTU UNDO BLOCK
Block recovery from logseq 29230, block 56 to scn 10603747634191
*** 2011-11-23 11:18:36.641
Recovery of Online Redo Log: Thread 1 Group 1 Seq 29230 Reading mem 0
Block recovery completed at rba 29230.66.16, scn 2468.3768347664
----- Redo read statistics for thread 1 -----
Read rate (ASYNC): 383Kb in 0.06s => 6.24 Mb/sec
Total physical reads: 4096Kb
Longest record: 0Kb, moves: 0/11 (0%)
Longest LWN: 1Kb, moves: 0/7 (0%), moved: 0Mb
Last redo scn: 0x09a4.e09c6c0e (10603747634190)
----------------------------------------------
Block image after block recovery:
buffer tsn: 1 rdba: 0x008003cc (2/972)
scn: 0x09a4.e09bc65c seq: 0x01 flg: 0x04 tail: 0xc65c0201
frmt: 0x02 chkval: 0x409e type: 0x02=KTU UNDO BLOCK
Hex dump of block: st=0, typ_found=1
Dump of memory from 0x00000003D13FA000 to 0x00000003D13FC000
3D13FA000 02A20000 008003CC E09BC65C 09A40104 [...........\....]
3D13FA010 409E0000 00020018 00065BF2 C49F1515 [#.........[.....]
3D13FA020 00001FE8 1F641ED8 1E041D7C 1CF81C5C [.....d.....|...\]
3D13FA030 1BC41B40 1ADC1A88 1A1C1998 192818A8 [...#.........(..]
3D13FA040 1810172C 16C4166C 15E8156C 14D40000 [...,...l...l....]
3D13FA050 00000000 00000000 00000000 00000000 [................]
Repeat 328 times
3D13FB4E0 00000000 00000000 000C0048 0020001D [...........H. ..]
3D13FB4F0 00020000 000000ED 000000ED 00000000 [................]
3D13FB500 00000000 0B011800 04080001 008003CC [................]
3D13FB510 C49F1300 E09BC00B 09A40000 E09BC011 [................]
3D13FB520 09A40001 000A0024 E09BC647 09A4FFFF [.......$...G....]
3D13FB530 008003C5 00000000 00000000 04010000 [................]
3D13FB540 00000000 00070010 0004935C 00800580 [...........\....]
3D13FB550 9B5B1600 800009A4 E09BC643 0040067A [.[.........C.#.z]
3D13FB560 00400679 12FF0501 020076C0 2C000100 [.#.y......v.,...]
3D13FB570 00001301 FFF90100 00000000 00050000 [................]
...skipping...
child# table reference handle
------ -------- --------- --------
0 3dac7ffd8 3dac7fc48 3de7ab528
DATA BLOCKS:
data# heap pointer status pins change whr
----- -------- -------- --------- ---- ------ ---
0 3de7abae8 3dac80628 I/P/A/-/- 0 NONE 00
----------------------------------------
SO: 3df696d30, type: 12, owner: 3df4091d8, flag: -/-/-/0x00
KSV Slave Class State
--------------
slave num 0, incarnation 1, KSV Context 3df694da0, creator: 3df2f5ff8
slave flags: 0x102
ksvcctx: 3df694da0 dpptr: 3df696d30 exitcond: 0 class#: 5
active: 1 spawned: 1 max: a flags: 0x2 enqueue: 0
directmsghdl: 3df4678b8 workmsghdl: 3df467928
ksvwqlr: 3df694da0 latch 3df694da0
ksvrecv: 3df694e40 op: 0x0 ro = 0 owner = 0
Queue (0)
ksvmqd: 3df694e90 count : 0
ksvwqlr: 3df694e90 latch 3df694e90
ksvrecv: 3df694f30 op: 0x0 ro = 0 owner = 0
Queue messages 3df694f50 Is Empty [3df694f50,3df694f50]
Queue (1)
ksvmqd: 3df694f68 count : 0
ksvwqlr: 3df694f68 latch 3df694f68
ksvrecv: 3df695008 op: 0x0 ro = 0 owner = 0
Queue messages 3df695028 Is Empty [3df695028,3df695028]
Queue (2)
ksvmqd: 3df695040 count : 0
ksvwqlr: 3df695040 latch 3df695040
ksvrecv: 3df6950e0 op: 0x0 ro = 0 owner = 0
Queue messages 3df695100 Is Empty [3df695100,3df695100]
dmsg: sendq: 3df696dc0 Is Empty [3df696dc0,3df696dc0]
dmsg: recvq: 3df696dd0 Is Empty [3df696dd0,3df696dd0]
dmsg: doneq: 3df696de0 Is Empty [3df696de0,3df696de0]
wmsg: workq: 3df696df0 Is Empty [3df696df0,3df696df0]
wmsg: doneq: 3df696e00 Is Empty [3df696e00,3df696e00]
Class Context: active: 1, spawned: 1, max: 10
Context Flags: 0x2, Work Queue: 3df694e90, Class Num: 5
----------------------------------------
SO: 3ddfcbbe8, type: 41, owner: 3df4091d8, flag: INIT/-/-/0x00
(dummy) nxc=0, nlb=1
----------------------------------------
SO: 3ddf46648, type: 39, owner: 3ddfcbbe8, flag: -/-/-/0x00
(List of Blocks) next index = 5
index itli buffer hint rdba savepoint
-----------------------------------------------------------
0 1 0x3d0fa00a8 0xc05534 0x6b69
1 2 0x3d0f9f2d8 0xc002ee 0x6b6b
2 2 0x3d0f97ce8 0xc002f8 0x6b6d
3 2 0x3d0f97ac8 0xc00300 0x6b6f
4 2 0x3d0f97578 0xc0894a 0x6b71
----------------------------------------
SO: 3df43ad08, type: 3, owner: 3df2f9f38, flag: INIT/-/-/0x00
(call) sess: cur 3df4091d8, rec 3df4053c8, usr 3df4091d8; depth: 0
(k2g table)
error 600 detected in background process
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
Did you see the ORA-00600 [4194] errors? They look like this:
Errors in file /u/db1/app/oracle/admin/mydb/bdump/mydb_smon_13515.trc:
ORA-00600: internal error code, arguments: [4194], [21], [21], [], [], [], [], []
That's your problem.
ORA-00600 always means to work with Oracle Support on the problem. I did a quick lookup, and the 4194 error means you have undo segment corruption.
You may try redoing the clone, assuming the source database itself isn't corrupted. If the source has this problem too, you'll probably need to restore/recover the UNDO tablespace, at a minimum.
I strongly suggest you login to MOS support site, and look closely at this document:
ORA-600 [4194] "Undo Record Number Mismatch While Adding Undo Record"
[ID 39283.1]
Hope that helps.

Resources