I am working on the scripting program with Prolog, where they talk through the pipe and JSON-formatted data. Everything works fine except the json_read_dict/2 relation.
?- json_read_dict(F, "[{\"offset\":22784,\"esil\":\"ebp,ebp,^=,$z,zf,=,$p,pf,=,$s,sf,=,$0,cf,=,$0,of,=,0xffffffff,rbp,&=\",\"refptr\":false,\"fcn_addr\":0,\"fcn_last\":0,\"size\":2,\"opcode\":\"xor ebp, ebp\",\"disasm\":\"xor ebp, ebp\",\"bytes\":\"31ed\",\"family\":\"cpu\",\"type\":\"xor\",\"type_num\":28,\"type2_num\":0,\"flags\":[\"entry0\",\"rip\"]}]\n\n").
ERROR: Arguments are not sufficiently instantiated
ERROR: In:
ERROR: [11] get_code(_1324,_1326)
ERROR: [10] json:json_value(_1356,_1358,_1360,json_options(null,true,false,string,'')) at /usr/lib64/swipl-7.6.4/library/http/json.pl:260
ERROR: [9] json:json_read_dict(_1404,"[{\"offset\":22784,\"esil\":\"ebp,ebp,^=,$z,zf,=,$p,pf,=,$s,sf,=,$0,cf,=,$0,of,=,0xffffffff,rbp,&=\",\"refptr\":false,\"fcn_addr\":0,\"fcn_last\":0,\"size\":2,\"opcode\":\"xor ebp, ebp\",\"disasm\":\"xor ebp, ebp\",\"bytes\":\"31ed\",\"family\":\"cpu\",\"type\":\"xor\",\"type_num\":28,\"type2_num\":0,\"flags\":[\"entry0\",\"rip\"]}]\n\n",[]) at /usr/lib64/swipl-7.6.4/library/http/json.pl:934
ERROR: [7] <user>
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
How it is possible to parse this output with SWI-Prolog?
The json_read_dict/2 predicate takes a stream or stream alias as first argument. You cannot call it with the first argument unbound, hence the instantiation error. Maybe you're looking for the functionality of the atom_json_dict/3 predicate?
?- atom_json_dict("[{\"offset\":22784,\"esil\":\"ebp,ebp,^=,$z,zf,=,$p,pf,=,$s,sf,=,$0,cf,=,$0,of,=,0xffffffff,rbp,&=\",\"refptr\":false,\"fcn_addr\":0,\"fcn_last\":0,\"size\":2,\"opcode\":\"xor ebp, ebp\",\"disasm\":\"xor ebp, ebp\",\"bytes\":\"31ed\",\"family\":\"cpu\",\"type\":\"xor\",\"type_num\":28,\"type2_num\":0,\"flags\":[\"entry0\",\"rip\"]}]\n\n", D, []).
D = [_19642{bytes:"31ed", disasm:"xor ebp, ebp", esil:"ebp,ebp,^=,$z,zf,=,$p,pf,=,$s,sf,=,$0,cf,=,$0,of,=,0xffffffff,rbp,&=", family:"cpu", fcn_addr:0, fcn_last:0, flags:["entry0", "rip"], offset:22784, opcode:"xor ebp, ebp", refptr:false, size:2, type:"xor", type2_num:0, type_num:28}].
Update
It seems that you get the json(illegal_json) syntax error due to the presence of a starting quote in the output that we're trying to parse. Try instead:
read_result(Out, Json) :-
read_string(Out, "", "", _, String),
atom_json_dict(String, Json, []).
Using your sample call:
?- with_command("/bin/ls", "ij", O).
O = _5058{bin:_4930{arch:"x86", binsz:38688, bintype:"mach0", bits:64, canary:true, checksums:_4926{}, class:"MACH064", compiled:"", crypto:false, dbg_file:"", endian:"little", guid:"", havecode:true, intrp:"/usr/lib/dyld", lang:"c", linenum:false, lsyms:false, machine:"x86 64 all", maxopsz:16, minopsz:1, nx:false, os:"macos", pcalign:0, pic:true, relocs:false, retguard:false, rpath:"", static:false, stripped:true, subsys:"darwin", va:true}, core:_4498{block:256, fd:3, file:"/bin/ls", format:"mach064", humansz:"37.8K", iorw:false, mode:"r-x", obsz:0, size:38688, type:"Executable file"}}.
I am attaching the exception log and base URL below
URL:
https://dev.xxxxxxx.com/admin/customer/index/edit/id/12/key/xxxxxxxxxxxxxxxxxxxxxxxx/
EXCEPTION:
1 exception(s):
Exception #0 (BadMethodCallException): Missing required argument $options of Magento\Eav\Model\Entity\Attribute\Source\Config.
Exception #0 (BadMethodCallException): Missing required argument $options of Magento\Eav\Model\Entity\Attribute\Source\Config.
#0 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(82): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\Eav\Mod...', Array, Array)
#1 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Eav\Mod...', Array)
#2 /var/www/html/vendor/magento/framework/Validator/UniversalFactory.php(36): Magento\Framework\ObjectManager\ObjectManager->create('Magento\Eav\Mod...', Array)
#3 /var/www/html/vendor/magento/module-eav/Model/Entity/Attribute/AbstractAttribute.php(537): Magento\Framework\Validator\UniversalFactory->create('Magento\Eav\Mod...')
#4 /var/www/html/vendor/magento/module-customer/Model/Customer/DataProvider.php(320): Magento\Eav\Model\Entity\Attribute\AbstractAttribute->getSource()
#5 /var/www/html/vendor/magento/module-customer/Model/Customer/DataProvider.php(152): Magento\Customer\Model\Customer\DataProvider->getAttributesMeta(Object(Magento\Eav\Model\Entity\Type))
#6 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(93): Magento\Customer\Model\Customer\DataProvider->__construct('customer_form_d...', 'entity_id', 'id', Object(Magento\Ui\DataProvider\EavValidationRules), Object(Magento\Customer\Model\ResourceModel\Customer\CollectionFactory), Object(Magento\Eav\Model\Config), Object(Magento\Framework\View\Element\UiComponent\DataProvider\FilterPool), Array, Array)
#7 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(89): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\Custome...', Array)
#8 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Custome...', Array)
#9 /var/www/html/vendor/magento/framework/View/Element/UiComponent/Argument/Interpreter/ConfigurableObject.php(60): Magento\Framework\ObjectManager\ObjectManager->create('Magento\Custome...', Array)
#10 /var/www/html/var/generation/Magento/Framework/Data/Argument/InterpreterInterface/Proxy.php(95): Magento\Framework\View\Element\UiComponent\Argument\Interpreter\ConfigurableObject->evaluate(Array)
#11 /var/www/html/vendor/magento/framework/Data/Argument/Interpreter/Composite.php(61): Magento\Framework\Data\Argument\InterpreterInterface\Proxy->evaluate(Array)
#12 /var/www/html/vendor/magento/module-ui/Model/Manager.php(188): Magento\Framework\Data\Argument\Interpreter\Composite->evaluate(Array)
#13 /var/www/html/vendor/magento/module-ui/Model/Manager.php(192): Magento\Ui\Model\Manager->evaluateComponentArguments(Array)
#14 /var/www/html/vendor/magento/module-ui/Model/Manager.php(172): Magento\Ui\Model\Manager->evaluateComponentArguments(Array)
This issue occur post migration and i have tried all cache process and deleted that many times so please provide some other good way to fix
In case any other information required let me know.
You can change your \Magento\Eav\Model\Entity\Attribute\Source\Config
from
public function __construct(array $options)
to
public function __construct(array $options = null)
and make a breackpoint at line
$this->_optionsData = $options;
to catch the case when $options is not set. So you would find the corresponding attribute and fix it.
Refer this link :- https://github.com/magento/magento2/issues/10141
This link solved my problem.
I am trying to setup Mediawiki. I have confirmed that i am able to load Special pages (any of them), but when it comes to the regular pages the site dies with the following:
Exception encountered, of type "FileBackendException"
[32b52f48] /Main_Page FileBackendException from line 125 of /......../mediawiki/includes/filebackend/FileBackendGroup.php: Backend with name `shared-backend` already registered.
Backtrace:
#0 /......../mediawiki/includes/filebackend/FileBackendGroup.php(109): FileBackendGroup->register(array)
#1 /......../mediawiki/includes/filebackend/FileBackendGroup.php(47): FileBackendGroup->initFromGlobals()
#2 /......../mediawiki/includes/filerepo/FileRepo.php(152): FileBackendGroup::singleton()
#3 /......../mediawiki/includes/filerepo/LocalRepo.php(54): FileRepo->__construct(array)
#4 /......../mediawiki/includes/filerepo/RepoGroup.php(418): LocalRepo->__construct(array)
#5 /......../mediawiki/includes/filerepo/RepoGroup.php(403): RepoGroup->newRepo(array)
#6 /......../mediawiki/includes/filerepo/RepoGroup.php(228): RepoGroup->initialiseRepos()
#7 /......../mediawiki/includes/GlobalFunctions.php(4079): RepoGroup->checkRedirect(Title)
#8 /......../mediawiki/includes/parser/Parser.php(2247): wfIsBadImage(string, Title)
#9 /......../mediawiki/includes/parser/Parser.php(2013): Parser->replaceInternalLinks2(string)
#10 /......../mediawiki/includes/parser/Parser.php(1262): Parser->replaceInternalLinks(string)
#11 /......../mediawiki/includes/parser/Parser.php(439): Parser->internalParse(string)
#12 /......../mediawiki/includes/content/WikitextContent.php(331): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#13 /......../mediawiki/includes/content/AbstractContent.php(497): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#14 /......../mediawiki/includes/poolcounter/PoolWorkArticleView.php(140): AbstractContent->getParserOutput(Title, integer, ParserOptions)
#15 /......../mediawiki/includes/poolcounter/PoolCounterWork.php(123): PoolWorkArticleView->doWork()
#16 /......../mediawiki/includes/page/Article.php(676): PoolCounterWork->execute()
#17 /......../mediawiki/includes/actions/ViewAction.php(44): Article->view()
#18 /......../mediawiki/includes/MediaWiki.php(490): ViewAction->show()
#19 /......../mediawiki/includes/MediaWiki.php(287): MediaWiki->performAction(Article, Title)
#20 /......../mediawiki/includes/MediaWiki.php(714): MediaWiki->performRequest()
#21 /......../mediawiki/includes/MediaWiki.php(508): MediaWiki->main()
#22 /......../mediawiki/index.php(41): MediaWiki->run()
#23 {main}
Unfortunately there is no documentation that i can find anywhere that deals with this exception apart from this which isn't of much use.
I have tried disabling all of the extensions, thinking that some of them may be at fault, generating some object that needs to remain as a singleton, but that didn't help.
$wgFileBackends is only defined once in DefaultSettings.php.
# grep -R 'wgFileBackends' .
./includes/DefaultSettings.php: * The name "local-fs" should correspond by name to an entry in $wgFileBackends.
./includes/DefaultSettings.php: * #see $wgFileBackends
./includes/DefaultSettings.php: * - backend A file backend name (see $wgFileBackends).
./includes/DefaultSettings.php:$wgFileBackends = array();
./includes/filebackend/FileBackendGroup.php: global $wgLocalFileRepo, $wgForeignFileRepos, $wgFileBackends;
./includes/filebackend/FileBackendGroup.php: $this->register( $wgFileBackends );
./includes/filebackend/README:$wgFileBackends. To access one of those defined backends, one would use
./includes/externalstore/ExternalStoreMwstore.php: * The file backends must be defined in $wgFileBackends and must be global
./tests/phpunit/includes/filebackend/FileBackendTest.php: global $wgFileBackends;
./tests/phpunit/includes/filebackend/FileBackendTest.php: foreach ( $wgFileBackends as $conf ) {
./tests/phpunit/includes/filerepo/StoreBatchTest.php: global $wgFileBackends;
./tests/phpunit/includes/filerepo/StoreBatchTest.php: foreach ( $wgFileBackends as $conf ) {
./tests/phpunit/includes/parser/NewParserTest.php: global $wgFileBackends;
./tests/phpunit/includes/parser/NewParserTest.php: foreach ( $wgFileBackends as $conf ) {
Thanks to Tgr's comments i was able to figure out the answer.
The problem was the $wgForeignFileRepos array that was defined in the LocalSettings.php. It was left from the previous version of Mediawiki, where apparently same names were not the problem.
It is essential that the names given to the cells is different and none can be titled 'shared'. This point is actually made on the $wgForeignFileRepos documentation page:
$wgForeignFileRepos[] = array(
'class' => 'ForeignAPIRepo',
'name' => 'commonswiki', // Must be a distinct name
'apibase' => 'https://commons.wikimedia.org/w/api.php',
'hashLevels' => 2,
...
);
I am building a C application on Linux platform. I need to use libmysqlclient for interfacing to database.
I downloaded Linux source code package mysql-connector-c-6.0.2.tar.gz. I compiled it as per the instructions. I get the below libraries:
libmysqlclient.a libmysqlclient.so libmysql.so.16
libmysqlclient_r.so libmysql.so libmysql.so.16.0.0
If my application is multi-threaded, can I link my application with libmysqlclient.a? As per mysql documentation (http://forge.mysql.com/wiki/Autotools_to_CMake_Transition_Guide), with cmake tool, clients are always thread safe.
After linking my application with libmysqlclient.a, I get a crash in my application with below call stack:
#0 0x0867878a in my_stat ()
No symbol table info available.
#1 0x08671611 in init_available_charsets.clone.0 ()
No symbol table info available.
#2 0x086720d5 in get_charset_by_csname ()
No symbol table info available.
#3 0x086522af in mysql_init_character_set ()
No symbol table info available.
#4 0x0865266d in mysql_real_connect ()
In my application, I have below code in the thread function:
if (NULL == (pMySQL = mysql_init(NULL)))
{
return -1;
}
if (NULL == mysql_real_connect(pMySQL, ServerName, UserName, Password, Name, Port, NULL, 0))
{
mysql_close(pMySQL);
return -1;
}
if (0 != mysql_query(pMySQL, pQuery))
{
mysql_close(pMySQL);
return -1;
}
mysql_close(pMySQL);
I am not using libmysqlclient_r.so as I want to link to mysql client library statically. Is there any way to generate libmysqlclient_r.a with cmake?
Update:
Without doing anything else, I just changed mysql client build type to debug. Now I get the crash in mysql_init() function.
On the application console, I get below print:
safe_mutex: Trying to lock unitialized mutex at /install/mysqlconnc/mysql-connector-c-6.0.2/mysys/safemalloc.c, line 520
The call stack of the crash is as below:
#0 0x00556430 in __kernel_vsyscall ()
No symbol table info available.
#1 0x45fdf2f1 in raise () from /lib/libc.so.6
No symbol table info available.
#2 0x45fe0d5e in abort () from /lib/libc.so.6
No symbol table info available.
#3 0x086833e5 in safe_mutex_lock (mp=0x915e8e0, my_flags=0,
file=0x895b9d8 "/install/mysqlconnc/mysql-connector-c-6.0.2/mysys/safemalloc.c", line=520)
at /install/mysqlconnc/mysql-connector-c-6.0.2/mysys/thr_mutex.c:178
error = 140915306
__PRETTY_FUNCTION__ = "safe_mutex_lock"
#4 0x08682715 in _sanity (
filename=0x895a87c "/install/mysqlconnc/mysql-connector-c-6.0.2/mysys/my_error.c", lineno=195)
at /install/mysqlconnc/mysql-connector-c-6.0.2/mysys/safemalloc.c:520
irem = 0xf2300468
flag = 0
count = 0
#5 0x0868186b in _mymalloc (size=16,
filename=0x895a87c "/install/mysqlconnc/mysql-connector-c-6.0.2/mysys/my_error.c", lineno=195, MyFlags=16)
at /install/mysqlconnc/mysql-connector-c-6.0.2/mysys/safemalloc.c:130
irem = 0x0
data = 0x0
_db_stack_frame_ = {func = 0x6d617266 <Address 0x6d617266 out of bounds>, file = 0x65685f65 <Address 0x65685f65 out of bounds>,
level = 0, prev = 0x0}
#6 0x0867e0e1 in my_error_register (errmsgs=0x89a7760, first=2000, last=2058)
at /install/mysqlconnc/mysql-connector-c-6.0.2/mysys/my_error.c:194
meh_p = 0x46087568
search_meh_pp = 0x1000
#7 0x08655f7e in init_client_errs ()
at /install/mysqlconnc/mysql-connector-c-6.0.2/libmysql/errmsg.c:238
No locals.
#8 0x08655fe3 in mysql_server_init (argc=0, argv=0x0, groups=0x0)
at /install/mysqlconnc/mysql-connector-c-6.0.2/libmysql/libmysql.c:128
result = 0
#9 0x08651fc0 in mysql_init (mysql=0x0)
at /install/mysqlconnc/mysql-connector-c-6.0.2/libmysql/client.c:1606
Solution:
I put a call to mysql_library_init() before creation of threads and put a call to mysql_library_end() after termination of threads. In each thread, I put a call to mysql_thread_init() at the start of thread function and put a call to mysql_thread_end() at the end of thread function. This solved the problem of crashing.
Update:
It seems that you need to call mysql_library_init() before mysql_init():
You must either call mysql_library_init()
prior to spawning any threads, or else use a mutex to protect the
call, whether you invoke mysql_library_init() or indirectly through
mysql_init(). Do this prior to any other client library call.
Regarding your original question, libmysqlclient_r.so is actually a symbolic link to libmysql.so. You can change libmysql/CMakeLists.txt to produce a static library (libmysql.a) instead by removing the SHARED keyword from the following line:
ADD_LIBRARY(libmysql SHARED ${CLIENT_SOURCES} libmysql.def)
However, I would recommend (1) trying to run the same code without using threads and see if the problem persists, (2) building and using the debug version of the libraries:
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
make
This way you could investigate the problem in more details.