Vichuploader breaks entity - Unexpected EOF - orm

I am installing the package Vichuploader (https://github.com/dustin10/VichUploaderBundle).
To make the file upload when no other inputs are changed from the entity I migrated my entity to add updated_at field.
After this migration my entity does not update anymore.
I can create a new entity without any problems but I have weird (non 500) errors:
Fatal error: Maximum execution time of 30+2 seconds exceeded (terminated) in /Users/alphabetus/Documents/repos/fluid-cms/src/Controller/BlockController.php on line 181
ERROR| SERVER issue with server callback error="unable to fetch the response from the backend: unexpected EOF"
ERROR| SERVER POST (502) /admin/blocks/edit/706ae964-e2c1-11ea-b09a-69c7fbc1be88 host="127.0.0.1:8004" ip="::1" scheme="https"
My line #181 contains the following:
/**
* #return File\Null
*/
public function getImageFile()
{
return $this->image_file; // line 81
}
public function setImageFile(File $image_file = null): void
{
$this->image_file = $image_file;
if ($image_file) {
$this->updated_at = new \DateTime('none');
}
}
I am new to symfony. What am I doing wrong?
Thanks

Judging from your error message, the time it takes to process the file is too long (more the 30 seconds) so your PHP servers kills the process.
You can use set_time_limit in your index.php file or change the max_execution_time in php.ini.
Also, the error points to line 181 from BlockController.php not your entity.
If this doesn't fix your issue please supply more details/code. I've used VichUploderBundle quite a lot (including the updatedAt trigger) without any issues.

Related

Database timeout in Azure SQL

We have a .Net Core API accessing Azure SQL (Gen5, 4 vCores)
Since quite some time,
the API keeps throwing below exception for a specific READ operation
Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout
Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
The READ operation has code to read rows of data and convert an XML column into a specific output format.
Most of the read operation extracts hardly 4-5 rows # a time.
The tables involved in the query have ~ 500,000 rows
We are clueless on Root Cause of this issue.
Any hints on where to start looking # for root cause?
Any pointer would be highly appreciated.
NOTE : Connection string has following settings, apart from others
MultipleActiveResultSets=True;Connection Timeout=60
Overall code looks something like this.
HINT: The above timeout exception comes # ConvertHistory, when the 2nd table is being read.
HttpGet]
public async Task<IEnumerable<SalesOrders>> GetNewSalesOrders()
{
var SalesOrders = await _db.SalesOrders.Where(o => o.IsImported == false).OrderBy(o => o.ID).ToListAsync();
var orders = new List<SalesOrder>();
foreach (var so in SalesOrders)
{
var order = ConvertSalesOrder(so);
orders.Add(order);
}
return orders;
}
private SalesOrder ConvertSalesOrder(SalesOrder o)
{
var newOrder = new SalesOrder();
var oXml = o.XMLContent.LoadFromXMLString<SalesOrder>();
...
newOrder.BusinessUnit = oXml.BusinessUnit;
var history = ConvertHistory(o.ID);
newOrder.history = history;
return newOrder;
}
private SalesOrderHistory[] ConvertHistory(string id)
{
var history = _db.OrderHistory.Where(o => o.ID == id);
...
}
Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
From Microsoft Document,
You will get this error in both conditions Connection timeout or Query or command timeout. first identify it from call stack of the error messages.
If you found it as a connection issue you can either Increase connection timeout parameter. if you are still getting same error, it is causing due to a network issue.
from information that you provided It is Query or command timeout error to work around this error you can set CommandTimeout for query or command
command.CommandTimeout = 10;
The default timeout value is 30 seconds, the query will continue to run until it is finished if the time-out value is set to 0 (no time limit).
For more information refer Troubleshoot query time-out errors provided by Microsoft.

I need help upgrading OroCommerce to 4.1.1

I just upgraded from 3.1.17 to 4.1.1 and I'm finding a problem with my shopping lists.
When I get to /customer/shoppinglist/5064 I see this:
Looking at my log files from production I see:
[2020-06-23 17:42:56] request.CRITICAL: Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\UndefinedMethodError: "Attempted to call an undefined method named "getDigitalAsset" of class "Proxies\__CG__\Oro\Bundle\AttachmentBundle\Entity\File"." at /usr/share/nginx/html/oroapp/vendor/oro/platform/src/Oro/Bundle/DigitalAssetBundle/Provider/FileTitleProvider.php line 47 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Attempted to call an undefined method named \"getDigitalAsset\" of class \"Proxies\\__CG__\\Oro\\Bundle\\AttachmentBundle\\Entity\\File\". at /usr/share/nginx/html/oroapp/vendor/oro/platform/src/Oro/Bundle/DigitalAssetBundle/Provider/FileTitleProvider.php:47)"} []
I went to look at the code and I see that in fact there is no method getDigitalAsset in oro/platform/src/Oro/Bundle/DigitalAssetBundle/Provider/FileTitleProvider.php, nor in the proxy... how can this be?
I checked this on my VM (where the problem is not happening) and I see that there's this definition in the proxy class:
/**
* {#inheritDoc}
*/
public function getDigitalAsset()
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'getDigitalAsset', []);
return parent::getDigitalAsset();
}
But again, I don't see a method called getDigitalAsset in the parent class.
I had some issues when doing the upgrade (I realized my nodejs wasn't upgraded as I thought it was), could that have anything to do with the issue?
Thanks
Edit:
I went through my platform upgrade again and found that there were some problems that prevented it from finishing completely.
This is what I found:
> loading Oro\Bundle\CMSBundle\Migrations\Data\ORM\LoadImageSlider
In LoadImageSlider.php line 117:
Attempted to call an undefined method named "setMainImage" of class "Oro\Bundle\CMSBundle\Entity\ImageSlide".
I commented out the loop inside the load method and re-run the upgrade. Then I got:
> loading Oro\Bundle\CMSBundle\Migrations\Data\ORM\LoadImageSlider
In QueryException.php line 65:
[Semantical Error] line 0, col 117 near 'digitalAsset': Error: Class Oro\Bundle\AttachmentBundle\Entity\File has no association named digitalAsset
In QueryException.php line 43:
SELECT file, digitalAsset, sourceFile FROM Oro\Bundle\AttachmentBundle\Entity\File file INNER JOIN file.digitalAsset digitalAsset INNER JOIN digitalAsset.sourceFile sourceFile WHERE file.parentEntityClass = :parentEntityClass
AND file.parentEntityId = :parentEntityId AND file.parentEntityFieldName =
:parentEntityFieldName
Finally I was able to complete the upgrade by commenting out the whole body of the load method
I had some issues when doing the upgrade (I realized my nodejs wasn't upgraded as I thought it was), could that have anything to do with the issue?
It looks like you have multiple versions of nodejs installed. To make an application use the right one, you can provide the absolute path to the executable with the AssetBundle configuration, like:
# config/config.yml
oro_asset:
nodejs_path: /usr/local/node
npm_path: /usr/local/npm

I can't rename my transaction on HP Virtual User Generator Script

I've copied Vu's Script, (and of course renamed it) which have access to another DB, and when I run it I have in the output the old transaction name of the old script.
here is the old transaction name which are to seen in the output : MDM_GetAssociations
Here is the renamed transaction:MDM_GET_ASSOCIATIONS_Otmann
After renaming the transaction, I run the script, I got 2 errors:
1)
Error 14 undeclared identifier `MDM_GET_ASSOCIATIONS_Otmann' Action.c C:\GCDM_Test\Scripts\MDM\MDM_Get_POSTGRE_Otmann MDM_Get_POSTGRE_Otmann
2)
Error 15 type error in argument 1 to web_custom_request'; foundint' expected `pointer to const char' Action.c C:\GCDM_Test\Scripts\MDM\MDM_Get_POSTGRE_Otmann MDM_Get_POSTGRE_Otmann
and this is my script :
//########## start the test scenario ############
web_set_max_html_param_len("8000");
web_set_sockets_option("SSL_VERSION", "TLS");
web_add_auto_header("Content-Type","application/xml");
web_add_auto_header("Accept","application/json");
web_add_auto_header("Authorization",lr_eval_string("{AUTHORIZATION}"));
//GetAssociations, NOTE: our dummy customers have often NO associations!
web_reg_save_param("RESPONSE", "LB=", "RB=", "Search=Body", LAST);
lr_start_transaction((char*)MDM_GENERIC_TRANSACTION);
lr_start_transaction((char*)MDM_GET_ASSOCIATIONS);
web_custom_request(MDM_GET_ASSOCIATIONS,
"URL={TEST_ENV_HOSTNAME}/api/v3/clients/{BUSINESS_CONTEXT}/customers/{GCID}/associations",
"Method=GET",
"Resource=1", // => We are retrieving a ressource,
// which implies that it is not critical for the success of the script.
// Any failures (HTTP 404 - Not found etc.) in downloading the resource
// will be considered as warnings rather than errors.
"EncType=application/xml",
"Referer=Loadrunner",
LAST);
lr_end_transaction((char*)MDM_GET_ASSOCIATIONS, LR_AUTO);
lr_end_transaction((char*)MDM_GENERIC_TRANSACTION, LR_AUTO);
return 0;
}
and this is the output where the old transaction name apeared (MDM_GetAssociations), but I don't know where is she coded or from where she came, and as I said before when I try to change it in all position which has to do with Transactions,I got the errors mentioned above.
Here ist the output of the script, where you can see the name of the old the transaction(MDM_GetAssociations).
Action.c(13): Notify: Transaction "MDM_GenericServiceCall_ALL" started.
Action.c(14): Notify: Transaction "MDM_GetAssociations" started.
Action.c(15): web_custom_request("MDM_GetAssociations") started
Action.c(15): web_custom_request("MDM_GetAssociations") highest severity level was "warning", 505 body bytes, 1971 header bytes [MsgId: MMSG-26388]
Action.c(25): Notify: Transaction "MDM_GetAssociations" ended with "Pass" status (Duration: 1,8408 Wasted Time: 1,2668).
Action.c(26): Notify: Transaction "MDM_GenericServiceCall_ALL" ended with "Pass" status (Duration: 2,4066 Wasted Time: 1,2668).
Ending action Action.
Ending iteration 1.
You have two variables. You do not have their declarations here. You do not have their contents. And you appear to be casting them from another data type to a pointer to a character.
Does this pass with a literal, "My_Test_Transaction"? If so, then you are likely looking at oddities on how your variable is declared, populated and referenced.

How to handle a longer wait time for complex queries? Angularjs

I am using angularjs, breeze, mssql2012.
I have several queries that takes about 40 seconds to 1 minute to complete running. It is a search function that goes through several tables with records above 900K with several joins.
It shows up with a few errors:
500 (Internal Server Error)
[Error] Error retrieving dataThe wait
operation timed out Error: The wait operation timed out
I am not sure whether the error is with breeze or angular, but I'd like to make the wait time longer than a minute. The query does work on the server.
I've tried using the $timeout from angular, but it doesn't seem to work.
getSearch().then(function () {
common.$timeout(function () {
toggleSearchSpinner();
}, 1250);
});
Not quite sure how to use the timeout function.
I do have $timeout defined in the common module:
commonModule.factory('common',
['$q', '$rootScope', '$timeout', 'commonConfig', 'logger', common]);
function common($q, $rootScope, $timeout, commonConfig, logger) {
var throttles = {};
var service = {
// common angular dependencies
$broadcast: $broadcast,
$q: $q,
$timeout: $timeout,
};
return service;
}
I have multiple places in the application where queries might just take a long time and unfortunately it is unavoidable. It would be great if there was a one time setting that prolongs the timeout wait time.... Is there?

Exception in RavenDB when doing bulk inserts

I'm doing some bulk inserts with RavenDB, and at some random document I get an InvalidOperationException with a HTTP 403 (forbidden), and the message "This single use token has expired".
The code is pretty straightforward:
using (var bulkInsert = store.BulkInsert("MyDatabase", new BulkInsertOptions { CheckForUpdates = true, BatchSize = 512 })
{
// Mapping stuff
bulkInsert.store(doc, productId);
}
I have tried experimenting with the batch size without any luck.
How do I fix it?
I'm using RavenDB 2.5 build 2700 and hosting RavenDb as a Windows service.
When running RavenDB in a console, I can see that it logs this message:
Error when using events transport. An operation was attempted on a
nonexistent network connection.