buglwIP - A Lightweight TCP/IP stack - Bugs: bug #51287, lwip_netconn_do_gethostbyname -...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #51287: lwip_netconn_do_gethostbyname - signal mutex before end.

Submitted by:  Boberek <bober>
Submitted on:  Wed 21 Jun 2017 05:07:26 PM UTC  
 
Category: DNSSeverity: 3 - Normal
Item Group: NoneStatus: Duplicate
Privacy: PublicAssigned to: None
Open/Closed: ClosedPlanned Release: None
lwIP version: 2.0.2

Thu 22 Jun 2017 12:06:07 PM UTC, comment #4:

Duplicate from bug #46887

Dirk Ziegelmeier <dziegel>
Project Member
Thu 22 Jun 2017 11:50:28 AM UTC, comment #3:

It's my mistake.
I wrote bad version.
My version is not 2.02.
My version is dc36dbac27131cd5a2238e2ae5a583b889f41302
So.
Everything is now OK.
Bug not exist now.
bug should be closed

Boberek <bober>
Wed 21 Jun 2017 08:41:18 PM UTC, comment #2:

This sounds strangely familiar to bug #46887. From that bug report it sounds like lwip_netconn_do_dns_found is not supposed to be called synchronously from dns_gethostbyname_addrtype, is that correct?

If so, then sounds like Boberek found another instance

Joel Cunningham <jcunningham>
Project Member
Wed 21 Jun 2017 08:05:49 PM UTC, comment #1:

So you're actually using LWIP_MPU_COMPATIBLE==1?

Simon Goldschmidt <goldsimon>
Project Administrator
Wed 21 Jun 2017 05:07:26 PM UTC, original submission:

In function lwip_netconn_do_gethostbyname we have:

API_EXPR_DEREF(msg->err) = dns_gethostbyname_addrtype(msg->name,
API_EXPR_REF(msg->addr), lwip_netconn_do_dns_found, msg,

exist path in call dns_gethostbyname_addrtype with call lwip_netconn_do_dns_found()[when dhcp is just start working].

Scenario:
1. call netconn_gethostbyname(),send messege (tcpcallback) to tcp_thread and wait on semaphore for result.
2. tcp_thread call lwip_netconn_do_gethostbyname
3. lwip_netconn_do_gethostbyname call dns_gethostbyname_addrtype
4. somewhere in dns_gethostbyname_addrtype call lwip_netconn_do_dns_found.
5. lwip_netconn_do_dns_found signal semaphore.
6. In another thread netconn_gethostbyname() can continue (semaphore is signaled), function netconn_gethostbyname()is finished (address msg and err is not valid, is somewere in the stack).
7. Assign msg->err in statement:
API_EXPR_DEREF(msg->err) = dns_gethostbyname_addrtype(msg->name,
API_EXPR_REF(msg->addr), lwip_netconn_do_dns_found, msg,
write somewere in memory on the stack.
8. My program crash (tcp_thread write on stack another thread).

Fast my bugfix in netconn_gethostbyname() is add:
{
int err1 = tcpip_callback(lwip_netconn_do_nothing, &API_VAR_REF(msg));
if (err1 == SOK) {
sys_sem_wait(API_EXPR_REF_SEM(API_VAR_REF(msg).sem));
}
}
after:
sys_sem_wait(API_EXPR_REF_SEM(API_VAR_REF(msg).sem));

or wait some ms after:
sys_sem_wait(API_EXPR_REF_SEM(API_VAR_REF(msg).sem));

Boberek <bober>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dziegel (Posted a comment)
  • -unavailable- added by jcunningham (Posted a comment)
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by bober (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 22 Jun 2017 12:06:07 PM UTCdziegelStatusNone=>Duplicate
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1