LTI and Moodle

I cannot use external tool in Moodle 3.2.2. help!

 
Picture of 浅野 真之
I cannot use external tool in Moodle 3.2.2. help!
 

Help me.

I want to use external tool in moodle 3.2.2+.But, I cannot use this. 

[What I can do]

l can go to external tool setup page.

[What I cannot do]

I push submit button of setup page. but, I have gotten 500 error message. 

[error_message]

Potential coding error - active database transaction detected during request shutdown:\n* line 105 of /course/modlib.php: call to moodle_database->start_delegated_transaction()\n* line 161 of /course/modedit.php: call to add_moduleinfo()\n, referer: http://(my IP address)/moodle/course/modedit.phpadd=lti&type=&course=2&section=0&return=0&sr=0

[environment]

PHP 5.6.30

MySQL  5.6.36  

CentOS release 6.9 (Final)



 
Average of ratings: -
Picture of Ken Task
Re: I cannot use external tool in Moodle 3.2.2. help!
Particularly helpful Moodlers

First, share what you are filling in on the LTI form.  LTI resources were to be
opened and usable by all who desire to use them.  Don't think there are any
security/privacy issues by sharing that info.

Typically, one is entering a url to an XML file. 
Example:
https://www.eduappcenter.com/apps/162#.WQR-aMm1vFQ

So does your Moodle have
php supports for xml?

php -m |grep xml

will show loaded php modules for xml.

The error line and error is related to this code:

    // From this point we make database changes, so start transaction.
    $transaction = $DB->start_delegated_transaction();

which indicates/appears to indicate and issue with Moodle talking to the
DB server and DB for Moodle.

Thus, the place to look, might be database configuration.

Since it's CentOS, suggest installing MySQLTuner ... a perl script ... that checks the 'health' of the DB server/DB for Moodle setup.

'spirit of sharing', Ken


 
Average of ratings: -
Picture of 浅野 真之
Re: I cannot use external tool in Moodle 3.2.2. help!
 

Ken Task

thank you for your answer.

I filled only activity name, tool URL, consumer key, and secret.(This is like LTI 1.1.)

There are five extensions of PHP by  "php -m|grep xml".

libxml
xml
xmlreader
xmlrpc
xmlwriter

I checked my database using MySQL Tuner.

[result of MySQL check](I'm sorry. this is so long...)

 >>  MySQLTuner 1.6.0 - Major Hayden <major@mhtx.net>

 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/

 >>  Run with '--help' for additional options and output filtering

[--] Skipped version check for MySQLTuner script

[OK] Currently running supported MySQL version 5.6.36

[OK] Operating on 64-bit architecture


-------- Storage Engine Statistics -------------------------------------------

[--] Status: +ARCHIVE +BLACKHOLE +CSV

-FEDERATED +InnoDB +MRG_MYISAM

[--] Data in InnoDB tables: 18M (Tables: 370)

[OK] Total fragmented tables: 0


-------- Security Recommendations  -------------------------------------------

[OK] There is no anonymous account in all database users

[!!] User 'user@localhost' has no password set.

[!!] There is not basic password file list !


-------- Performance Metrics -------------------------------------------------

[--] Up for: 26m 28s (484 q [0.305 qps], 113 conn, TX: 545K, RX: 62K)

[--] Reads / Writes: 92% / 8%

[--] Binary logging is disabled

[--] Total buffers: 169.0M global + 1.1M per thread (151 max threads)

[OK] Maximum reached memory usage: 170.1M (8.48% of installed RAM)

[OK] Maximum possible memory usage: 338.9M (16.89% of installed RAM)

[OK] Slow queries: 0% (0/484)

[OK] Highest usage of available connections: 0% (1/151)

[!!] Aborted connections: 9.73%  (11/113)

[OK] Query cache efficiency: 25.2% (78 cached / 310 selects)

[OK] Query cache prunes per day: 0

[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 32 sorts)

[OK] Temporary tables created on disk: 4% (3 on disk / 70 total)

[OK] Thread cache hit rate: 99% (1 created / 113 connections)

[OK] Table cache hit rate: 98% (454 open / 461 opened)

[OK] Open file limit used: 0% (48/5K)

[OK] Table locks acquired immediately: 100% (221 immediate / 221 locks)

-------- MyISAM Metrics -----------------------------------------------------

[!!] Key buffer used: 18.2% (1M used / 8M cache)

[OK] Key buffer size / total MyISAM indexes: 8.0M/97.0K

[!!] Read Key buffer hit rate: 90.0% (10 cached / 1 reads)


-------- InnoDB Metrics -----------------------------------------------------

[--] InnoDB is enabled.

[OK] InnoDB buffer pool / data size: 128.0M/18.5M

[OK] InnoDB buffer pool instances: 1

[!!] InnoDB Used buffer: 21.07% (1726 used/ 8191 total)

[OK] InnoDB Read buffer efficiency: 94.58% (30040 hits/ 31761 total)

[!!] InnoDB Write buffer efficiency: 0.00% (0 hits/ 1 total)

[OK] InnoDB log waits: 0.00% (0 waits / 14 writes)


-------- AriaDB Metrics -----------------------------------------------------

[--] AriaDB is disabled.


-------- Replication Metrics -------------------------------------------------

[--] No replication slave(s) for this server.

[--] This is a standalone server..


-------- Recommendations -----------------------------------------------------

General recommendations:

    Set up a Password for user with the following SQL statement ( SET PASSWORD FOR 'user'@'SpecificDNSorIp' = PASSWORD('secure_password'); )

    MySQL started within last 24 hours - recommendations may be inaccurate

    Reduce or eliminate unclosed connections and network issues


 
Average of ratings: -
Picture of Ken Task
Re: I cannot use external tool in Moodle 3.2.2. help!
Particularly helpful Moodlers

This part:

"I filled only activity name, tool URL, consumer key, and secret.(This is like LTI 1.1.)"

please provide specifics ... to all of them ... the actual entries you made.

Tuner output ... one that catches my eye:

[!!] Aborted connections: 9.73%  (11/113)

Indicates there might be some issues in connectivity between the Moodle code on the web server and the DB server.   Apache error logs might also show that.

and this one:

Reduce or eliminate unclosed connections and network issues

Is the DB server on the same server as the moodle code it should be using socket connections.

'spirit of sharing', Ken

 
Average of ratings: -
Picture of 浅野 真之
Re: I cannot use external tool in Moodle 3.2.2. help!
 

> please provide specifics ... to all of them ... the actual entries you made.

I'm sorry. I tell you about them.
Activity name : LTItest
Tool URL : http://49.212.209.129/tool.php
Consumer key : 12345
Shared secret : secret
other forms : empty or default value(I don't change default customize of moodle 3.2.2+).

Masayuki Asano.




 
Average of ratings: -
Picture of Ken Task
Re: I cannot use external tool in Moodle 3.2.2. help!
Particularly helpful Moodlers

Thank you! ;)

In a test from command line to that URL and php script ... the following is returned ...

<p style="color:red">Could not establish context: <p>
<p>Base String:<br/>
<br/></p>
<pre>
Raw POST Parameters:
A lot of info about server where I tried to use it ... not disclosed here for obvious reasons.

Raw GET Parameters:

Nothing here.

So ... what is one supposed to see?

'spirit of sharing', Ken

 
Average of ratings: -
Picture of 浅野 真之
Re: I cannot use external tool in Moodle 3.2.2. help!
 

thank you for your report!
It is the response that I want.

The program is checking tool about LTI 1.1 POST values.
It made and provided IMS GLC two years ago.
Latest moodle use LTI 2.0. So, your launch might not catch normally it.


I often checked Apache error_log when you advised about it. But, There was not found new message except 'Potential coding error -
active database transaction detected during request shutdown:\n* line 105 of /course/modlib.php: call to moodle_database->start_delegated_transaction()\n* line
161 of /course/modedit.php: call to add_moduleinfo()\n, referer: http://160.16.110.61/moodle/course/modedit.php?add=lti&type=&course=2&section=0&return=0&sr=0"'...

I wander that I can add the other activity(Quiz,chat,and more...) to courses.
But,I cannot add only external tools to courses.

Would you mind to check php.ini and my.cnf of my moodle server?  

 
Average of ratings: -
Picture of Ken Task
Re: I cannot use external tool in Moodle 3.2.2. help!
Particularly helpful Moodlers

Huh?   Really?  That was the response you expected?   Uhhhh .... you could have done this test yourself from command line on a Mac or Linux!

Not sure what I'd be looking for nor what to suggest for config files as guessing settings isn't a good practice.   So I'll decline the invite.

Appears you have linux ... install MySQLTuner to check DB.

Someone else has reported a similar error as yours

"transaction detected during request shutdown"

A discussion about it ... 2014 ... but that was about quiz ...

https://moodle.org/mod/forum/discuss.php?d=263351

The line reported (161) is in this bit of code:

    if (!empty($fromform->update)) {
        list($cm, $fromform) = update_moduleinfo($cm, $fromform, $course, $mfor$
    } else if (!empty($fromform->add)) {
*161        $fromform = add_moduleinfo($fromform, $course, $mform);
    } else {
        print_error('invaliddata');
    }

Google finds quite a few hits on transaction detected during request shutdown' ...

https://www.google.com/search?q=transaction+detected+during+request+shutdown&ie=utf-8&oe=utf-8

So ??????

'spirit of sharing', Ken

 
Average of ratings: -
Picture of 浅野 真之
Re: I cannot use external tool in Moodle 3.2.2. help!
 
Mr Ken


what I was NOT able to understand happened in my moodle.

As a result, My problem was resolved.
I could launch LTI formatted data from my moodle 3.2.2+ server to tool provider's server.

[What I did]

I added the code into course/modlib.php (106~108).
<the code>

if(!isset($transaction)){

                echo "<script>alert('invalid_error!');</script>";

    }

Why did my moodle moved by the code to alert???

 
Average of ratings: -
Picture of Ken Task
Re: I cannot use external tool in Moodle 3.2.2. help!
Particularly helpful Moodlers

Not sure I understand the question, but suggest if you think it's a bug please report it in tracker.

https://tracker.moodle.org/secure/Dashboard.jspa

When you do, you'll have to provide steps for someone to be able to replicate the problem so you'll have to disclose info ... other wise, no one who is a true programmer can test.

Am not a coder.

'spirit of sharing', Ken

 
Average of ratings: -
Picture of 浅野 真之
Re: I cannot use external tool in Moodle 3.2.2. help!
 

Mr.Ken

I cannot judge whether these error is bug or not. And. The problem doesn't resolve essentially.Because, It was unstable to add LTI tool.(My check was not enough...sorry.)

But, I report Moodle Tracker these phenomenon. Because, honestly speaking, I think that my skill and knowledge about moodle is not enough to resolve the problem. I can only report that There is the problem.

But, at least, I could add LTI tool. This is the fact. I cannot thank you enough for this.

Thank you!

masayuki asano

 
Average of ratings: -
Picture of John Okely
Re: I cannot use external tool in Moodle 3.2.2. help!
Core developersParticularly helpful MoodlersPlugin developersTesters

The error seems very strange. Have you tried using the test provider and seeing if you get the same error? http://lti.tools/test/tp.php

 
Average of ratings: -