Oracle (Amazon RDS) session hangs - oracle

I have a primary process and a mirror process. They both connect to same schema. Primary process execute dml queries while mirror do the fetching. Randomly primary process is hanged in an update query with following stack trace
#0 0x00007fceaffe170d in read () from /lib64/libpthread.so.0
#1 0x00007fceb64c9150 in snttread () from /app/oracle/product/12.1.0.2/client_1/lib/libclntsh.so.12.1
#2 0x00007fceb48e7c75 in nttrd () from /app/oracle/product/12.1.0.2/client_1/lib/libclntsh.so.12.1
#3 0x00007fceb47c887a in nsprecv () from /app/oracle/product/12.1.0.2/client_1/lib/libclntsh.so.12.1
#4 0x00007fceb47d1bd5 in nsrdr () from /app/oracle/product/12.1.0.2/client_1/lib/libclntsh.so.12.1
#5 0x00007fceb5855282 in nsfull_pkt_rcv () from /app/oracle/product/12.1.0.2/client_1/lib/libclntsh.so.12.1
#6 0x00007fceb585b7af in nsfull_brc () from /app/oracle/product/12.1.0.2/client_1/lib/libclntsh.so.12.1
#7 0x00007fceb64bdaae in nsbrecv () from /app/oracle/product/12.1.0.2/client_1/lib/libclntsh.so.12.1
#8 0x00007fceb64b3b3e in nioqrc () from /app/oracle/product/12.1.0.2/client_1/lib/libclntsh.so.12.1
#9 0x00007fceb64c971d in ttcdrv () from /app/oracle/product/12.1.0.2/client_1/lib/libclntsh.so.12.1
#10 0x00007fceb64b8649 in nioqwa () from /app/oracle/product/12.1.0.2/client_1/lib/libclntsh.so.12.1
#11 0x00007fceb649a74c in upirtrc () from /app/oracle/product/12.1.0.2/client_1/lib/libclntsh.so.12.1
#12 0x00007fceb64a4f66 in kpurcsc () from /app/oracle/product/12.1.0.2/client_1/lib/libclntsh.so.12.1
#13 0x00007fceb649c042 in kpuexec () from /app/oracle/product/12.1.0.2/client_1/lib/libclntsh.so.12.1
#14 0x00007fceb649b0f9 in OCIStmtExecute () from /app/oracle/product/12.1.0.2/client_1/lib/libclntsh.so.12.1
When examined in session level (v$sqltext, v$lock), mirror is in a blocking (block=1) call with a select statement, while primary is in waiting (block=0) state with an update statement to the same table. Can a select statement be in a blocking call ? What are the directions that i can investigate this further ?

Related

how to generate it() tests after waiting on an asynchronous response

I want to generate it() tests in a loop, but the data required to drive the loop needs to be retrieved asynchronously first. I've tried solving the problem using before() but it won't work.
The code below retrieves and displays the parameters in the loop correctly but... the it() tests don't get executed.
It's as if mocha ignores it() that appear AFTER waiting on a promise.
describe('Generated tests', async () => {
const testParams = await <asynchronous call here>
testParams.forEach(testParam=> {
console.log(testParam)
it(`Generated test for ${testParam}, () => myTestFunc(testParam))
})
})
Solved this by placing await before describe:
describe('All Tests', async () => {
it('Level1 Test', () => <test code here> )
const testParams = await <async call here>
describe('Generated tests', () => {
testParams.forEach(testParam=> it(`Test ${testParam}`, ()=>testFunc(testParam))
})
})

Why is finalize lifted in RxJS?

I am having trouble understanding the finalize operator in RxJS. Let me demonstrate this on an example:
of(null).pipe(
tap({ complete: () => console.log('tap 1 completes') }),
finalize(() => console.log('finalize')),
tap({ complete: () => console.log('tap 2 completes') })
).subscribe({ complete: () => console.log('subscribe completes') });
I would expect the finalize callback to be executed before the second tap. That's not happening, though. Rather the above code produces the following output:
tap 1 completes
tap 2 completes
subscribe completes
finalize
Looking at the implementation I believe the operator is passed (lifted) through the whole observable chain to always be applied at its end. So now I end up with two questions:
What's the rationale behind this design decision? Can you give some explanation on why this is a desireable / advantageous property?
Is there a different operator or other solution to execute code on complete and on error, but in order (i.e. before the second tap in the above example) rather than at the end of the observable chain?
It's important to be aware that finalize() and tap() work very differently. tap() is triggered by next, error and complete notifications while finalize() is only triggerd on chain ubsubscription. In other words finalize() is very similar to using:
const subscription = $source.subscribe();
// This will be always triggered after all `tap()`s
subscription.add(() => console.log('same as finalize()'));
So you can't make finalize() to be invoked before tap(). Also, be aware that finalize() is invoked also when you manually unsubscribe liek the following:
subscription.unsubscribe(); // will always invoke `finalize()` but never `tap()`
One possible solution could be implementing you own finalize() variant that knows the reason why it's being called: https://github.com/martinsik/rxjs-extra/blob/master/doc/finalizeWithReason.md (see source code)
Also note, that https://github.com/ReactiveX/rxjs/pull/5433 will have no affect on your use-case.
That's the whole principle of the finalize operator. To emit only -after- the source observable completes. Which does mean, after all the complete subscriptions have been handled, counting the tap complete. From the docs:
Returns an Observable that mirrors the source Observable, but will call a specified function when the source terminates on complete or error.
Now you could place the finalize in an inner observable, but I suppose you wouldn't like the order then either
of(null).pipe(
tap({ complete: () => console.log('tap 1 completes') }),
concatMap((resp) => of(resp).pipe(
finalize(() => console.log('finalize'))
)),
tap({ complete: () => console.log('tap 2 completes') })
).subscribe({ complete: () => console.log('subscribe completes') });
This will make the finalize execute before the first and last tap, this is because of the complete object you pass into tap. If you just pass in a function in the first tap, it will have the right order.
Another way could be the usage of concat:
concat(
of(null).pipe(
tap({complete: () => console.log('tap 1 completes' ) }),
finalize(() => console.log('finalize'))
),
EMPTY.pipe(
tap({complete: () => console.log('tap 2 completes' ) })
)
).subscribe({ complete: () => console.log('subscribe completes') });
But this kinda prevents you from accessing what ever the first observable emitted. So, basically, I don't think there is a proper solution to what you are asking :)

Executing a function inside puppeteer context

So, basically, I'm writing tests for my app, and I'd like to run a function inside the puppeteer browser's context. This is what I've tried:
Test code:
const printBlah = () => {
console.log('blah');
};
describe('Printing blah', () => {
it('Should print "blah".', async () => {
await page.evaluate(() => printBlah());
});
});
The error I'm getting:
1) Printing blah
Should print "blah".:
Error: Evaluation failed: ReferenceError: printBlah is not defined
at __puppeteer_evaluation_script__:1:16
at ExecutionContext._evaluateInternal (node_modules/puppeteer/lib/ExecutionContext.js:93:19)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at ExecutionContext.evaluate (node_modules/puppeteer/lib/ExecutionContext.js:32:16)
-- ASYNC --
at ExecutionContext.<anonymous> (node_modules/puppeteer/lib/helper.js:82:19)
at DOMWorld.evaluate (node_modules/puppeteer/lib/DOMWorld.js:111:24)
-- ASYNC --
at Frame.<anonymous> (node_modules/puppeteer/lib/helper.js:82:19)
at Page.evaluate (node_modules/puppeteer/lib/Page.js:792:47)
at Page.<anonymous> (node_modules/puppeteer/lib/helper.js:83:27)
at /mnt/repos/r/p/src/p/index.spec.ts:124:16
at step (src/p/index.spec.ts:33:23)
at Object.next (src/p/index.spec.ts:14:53)
at /mnt/repos/r/p/src/p/index.spec.ts:8:71
at new Promise (<anonymous>)
at __awaiter (src/p/index.spec.ts:4:12)
at Context.<anonymous> (src/p/index.spec.ts:123:30)
at processImmediate (internal/timers.js:456:21)

Proteactor- jasmine - How to execute one js file inside another js

Suppose have A.js file with 10 it blocks, now in middle of exuction say in 6th it block need to execute another more js file say B.js
I'm not sure this is what you mean, but you could have several describe blocks with their it blocks inside of them.
describe('Main file', () => {
describe('Describe A', () => {
it('some it block from A', async () => {
// code here
});
});
describe('Describe B', () => {
it('some it block from B', async () => {
// code here
});
});
});

function names not displayed in gdb backtrace kgdb setup

I have set up a debugging environment of KGDB between two VMWare virtual machines using the following link:
https://embeddedguruji.blogspot.com/2018/12/debugging-linux-kernel-using-kgdb-part-1.html
When I run backtrace, I am not getting the function name. What I am missing here?
Program received signal SIGTRAP, Trace/breakpoint trap.
0xffffffff9f141990 in ?? ()
(gdb) bt
#0 0xffffffff9f141990 in ?? ()
#1 0xffffffff9f55d962 in ?? ()
#2 0x0000000000000002 in irq_stack_union ()
#3 0xffffba8801a87f10 in ?? ()
#4 0x00000000017c4408 in ?? ()
#5 0xffffba8801a87f10 in ?? ()
#6 0xffffffff9f55ddb4 in ?? ()
#7 0xffff949d8a62f740 in ?? ()
#8 0xffffffff9f2cf5cc in ?? ()
#9 0x0000000001917000 in ?? ()
#10 0xffff949daf914400 in ?? ()
#11 0xffffffff9f25a066 in ?? ()
#12 0xffff949db7109ea0 in ?? ()
#13 0xffff949daf914400 in ?? ()
#14 0x0000000000000002 in irq_stack_union ()
#15 0xffffba8801a87f10 in ?? ()
#16 0x0000000000000000 in ?? ()

Resources