SSL handshake 20s delay to complete process - ssl

We are experiencing a delay when accessing https:// connection to our server.
There is a delay around the 20s to display the content of the page which was trace to SSL handshake process
Using
strace -o /tmp/curl.trace.log -f -tt curl -kvv --trace-time https://10.20.23.7:
We trace this to
91445 09:22:03.711590 getpeername(3, {sa_family=AF_INET, sin_port=htons(9070), sin_addr=inet_addr("10.20.23.7")}, [16]) = 0
91445 09:22:03.773153 sendto(3, "\26\3\1\0\220\1\0\0\214\3\3\332\3n\204\371\2472v\341E[\2247=2;\336\214\266}\4"..., 149, 0, NULL, 0) = 149
91445 09:22:03.773267 recvfrom(3, 0x1c2b258, 5, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
91445 09:22:03.773315 poll([{fd=3, events=POLLIN|POLLPRI}], 1, 5000) = 0 (Timeout)
91445 09:22:08.778047 poll([{fd=3, events=POLLIN|POLLPRI}], 1, 5000) = 0 (Timeout)
91445 09:22:13.783040 poll([{fd=3, events=POLLIN|POLLPRI}], 1, 5000) = 0 (Timeout)
91445 09:22:18.787090 poll([{fd=3, events=POLLIN|POLLPRI}], 1, 5000) = 1 ([{fd=3, revents=POLLIN}])
91445 09:22:20.183606 recvfrom(3, "\26\3\3\n\264", 5, 0, NULL, NULL) = 5
91445 09:22:20.183724 recvfrom(3, "\2\0\0M\3\3]\312\300\34\367\363\256%V\25s)\tSVX\317*\272=\205(\311\1<\345"..., 2740, 0, NULL, NULL) = 2740
91445 09:22:20.184242 fcntl(4, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741824, len=1}) = 0
As I understand recvfrom is not able to read request which was sendto(..)
What mean line sendto, where request was sendto?
91445 09:22:03.773153 sendto(3, "\26\3\1\0\220\1\0\0\214\3\3\332\3n\204\371\2472v\341E[\2247=2;\336\214\266}\4"..., 149, 0, NULL, 0) = 149
Thank you for info.

Related

prestashop - Can't load Order status at line 242 in file classes/PaymentModule.php

when I order with an obligation to pay
[PrestaShopException]
Can't load Order status
at line 242 in file classes/PaymentModule.php
237. }
238.
239. $order_status = new OrderState((int) $id_order_state, (int) $this->context->language->id);
240. if (!Validate::isLoadedObject($order_status)) {
241. PrestaShopLogger::addLog('PaymentModule::validateOrder - Order Status cannot be loaded', 3, null, 'Cart', (int) $id_cart, true);
242. throw new PrestaShopException('Can\'t load Order status');
243. }
244.
245. if (!$this->active) {
246. PrestaShopLogger::addLog('PaymentModule::validateOrder - Module is not active', 3, null, 'Cart', (int) $id_cart, true);
247. die(Tools::displayError());
PaymentModuleCore->validateOrder - [line 58 - modules/ps_wirepayment/controllers/front/validation.php] - [9 Arguments]
Ps_WirepaymentValidationModuleFrontController->postProcess - [line 270 - classes/controller/Controller.php]
ControllerCore->run - [line 509 - classes/Dispatcher.php]
DispatcherCore->dispatch - [line 24 - override/classes/Dispatcher.php]
Dispatcher->dispatch - [line 28 - index.php]
insert with phpmyadmin the table
ps_order_state:
INSERT INTO `ps_order_state` (`id_order_state`, `invoice`, `send_email`, `module_name`, `color`, `unremovable`, `hidden`, `logable`, `delivery`, `shipped`, `paid`, `deleted`) VALUES
(1, 0, 1, 'cheque', 'RoyalBlue', 1, 0, 0, 0, 0, 0, 0),
(2, 1, 1, '', 'LimeGreen', 1, 0, 1, 0, 0, 1, 0),
(3, 1, 1, '', 'DarkOrange', 1, 0, 1, 0, 0, 1, 0),
(4, 1, 1, '', 'BlueViolet', 1, 0, 1, 1, 1, 1, 0),
(5, 1, 0, '', '#108510', 1, 0, 1, 1, 1, 1, 0),
(6, 0, 1, '', 'Crimson', 1, 0, 0, 0, 0, 0, 0),
(7, 1, 1, '', '#ec2e15', 1, 0, 0, 0, 0, 0, 0),
(8, 0, 1, '', '#8f0621', 1, 0, 0, 0, 0, 0, 0),
(9, 1, 1, '', 'HotPink', 1, 0, 0, 0, 0, 1, 0),
(10, 0, 1, 'bankwire', 'RoyalBlue', 1, 0, 0, 0, 0, 0, 0),
(11, 0, 0, '', 'RoyalBlue', 1, 0, 0, 0, 0, 0, 0),
(12, 1, 1, '', 'LimeGreen', 1, 0, 1, 0, 0, 1, 0),
(13, 1, 0, '', '#DDEEFF', 0, 0, 1, 0, 0, 0, 0);
Your ps_wirepayment module is trying to set an order status to an invalid / deleted id_order_state.
If you haven't modified it , bankwire modulee relies on ps_configuration "PS_OS_BANKWIRE" status value,
so make sure the ID value is valid and links to a valid order state in your database.

How to one hot encode numpy array of arrays using keras to_categorical?

I have target data y_tr in shape (92107, 49) where each sample (row) is an array of length 49. I would like to loop over y_tr and one hot encode each array. I have been using keras to_categorical though I am facing an Indexerror.
Array in y_tr:
array([ 379, 379, 379, 252, 4166, 391, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0], dtype=int32)
The number of classes to encode each integer index = 10,000. (I do not wish to encode zero values):
onehots=[]
for seq in y_tr[:,1:]:
try:
onehots.append(to_categorical(seq - 1, num_classes=tar_vocab_size, dtype=np.int32))
except IndexError as e:
raise e
76 n = y.shape[0]
77 categorical = np.zeros((n, num_classes), dtype=dtype)
---> 78 categorical[np.arange(n), y] = 1
79 output_shape = input_shape + (num_classes,)
80 categorical = np.reshape(categorical, output_shape)
IndexError: index 28350 is out of bounds for axis 1 with size 10000

Fill values in numpy array that are between a certain value

Let's say I have an array that looks like this:
a = np.array([0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0])
I want to fill the values that are between 1's with 1's.
So this would be the desired output:
a = np.array([0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0])
I have taken a look into this answer, which yields the following:
array([0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1])
I am sure this answer is really close to the output I want. However, although tried countless times, I can't change this code into making it work the way I want, as I am not that proficient with numpy arrays.
Any help is much appreciated!
Try this
b = ((a == 1).cumsum() % 2) | a
Out[10]:
array([0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0], dtype=int32)
From #Paul Panzer: use ufunc.accumulate with bitwise_xor
b = np.bitwise_xor.accumulate(a)|a
Try this:
import numpy as np
num_lst = np.array(
[0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0])
i = 0
while i < len(num_lst): # Iterate through the list
if num_lst[i]: # Check if element is 1 at i-th position
if not num_lst[i+1]: # Check if next element is 0
num_lst[i+1] = 1 # Change next element to 1
i += 1 # Continue through loop
else: # Check if next element is 1
i += 2 # Skip next element
else:
i += 1 # Continue through loop
print(num_lst)
This is probably not the most elegant way to execute this, but it should work. Basically, we loop through the list to find any 1s. When we find an element that is 1, we check if the next element is 0. If it is, then we change the next element to 1. If the next element is 1, that means we should stop changing 0s to 1s, so we jump over that element and proceed with the iteration.

Redis timeout issue

I am getting timeout issue with redis.
Following is the exception
System.TimeoutException: Timeout performing EVAL, inst: 1, mgr: ProcessReadQueue, err: never, queue: 7, qu: 0, qs: 7, qc: 0, wr: 0, wq: 0, in: 507, ar: 1, clientName: EG-APP04, serverEndpoint: Unspecified/####, keyHashSlot: 12598, IOCP: (Busy=0,Free=1600,Min=800,Max=1600), WORKER: (Busy=187,Free=1413,Min=800,Max=1600), Local-CPU: unavailable
Configuration: Connection string
connectionString="####,connectRetry=10, abortConnect=false, allowAdmin=true, ssl=false"
Am I missing something?
Try increasing your syncTimeout to a high value like below:
connectionString="####,connectRetry=10, abortConnect=false,
allowAdmin=true, ssl=false, syncTimeout=30000

which programming language is this? it's a file with *.bb extension

it was in a file with a *.bb extension, so what's the programming language?
this is a source code for a game called SCP-087-B, there is two file for the source code but i put the content of one in order to determine the programming language it used.
this is the source: SCP-087-B
Global ark_blur_image, ark_blur_texture, ark_sw, ark_sh
Function CreateBlurImage()
;Create blur camera
Local cam = CreateCamera()
CameraClsMode cam, 0, 0
CameraRange cam, 0.1, 1.5
MoveEntity cam, 0, 0, 10000
ark_sw = GraphicsWidth()
ark_sh = GraphicsHeight()
;Create sprite
Local spr = CreateMesh(cam)
Local sf = CreateSurface(spr)
AddVertex sf, -1, 1, 0, 0, 0
AddVertex sf, 1, 1, 0, 1, 0
AddVertex sf, -1, -1, 0, 0, 1
AddVertex sf, 1, -1, 0, 1, 1
AddTriangle sf, 0, 1, 2
AddTriangle sf, 3, 2, 1
EntityFX spr, 17
ScaleEntity spr, 2048.0 / Float(ark_sw), 2048.0 / Float(ark_sw), 1
PositionEntity spr, 0, 0, 1.0001
EntityOrder spr, -100000
EntityBlend spr, 1
ark_blur_image = spr
;Create blur texture
ark_blur_texture = CreateTexture(2048, 2048, 256)
EntityTexture spr, ark_blur_texture
End Function
Function UpdateBlur(power#)
EntityAlpha ark_blur_image, power#
CopyRect ark_sw / 2 - 1024, ark_sh / 2 - 1024, 2048, 2048, 0, 0, BackBuffer(), TextureBuffer(ark_blur_texture)
End Function
;~IDEal Editor Parameters:
;~C#Blitz3D
so what's the programming language of this code?
Seems to be Blitz Basic judging from the overall layout and function names.